parsing

C# - Reading in text file; parsing for specific text

I have a text data file which contains text like this: "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" 34i23042034002340 ----- "[category.ty...

Python program to search for specific strings in hash values (coding help)

Trying to write a code that searches hash values for specific string's (input by user) and returns the hash if searchquery is present in that line. Doing this to kind of just learn python a bit more, but it could be a real world application used by an HR department to search a .csv resume database for specific words in each resume. I'...

Are the outputs of javascript parsers of different browsers the same?

Suppose there is a piece of JavaScript code that is supported by different browsers, for example IE and Firefox. Would the JavaScript parsers of the different browsers generate the same output (i.e., the same AST)? ...

Import 5 millions records to the rails application

We need to import large amount of data(about 5 millions records) to the postgresql db under rails application. Data will be provided in xml format with images inside it encoded with Base64. Estimated size of the xml file is 40GB. What xml parser can handle such amount of data in ruby? Thanks. ...

Using or in multiline sed replacement

hi folks I'm confused with a seeming simple part of sed - the or statement. I wrote the following sed which parses an event file with multiple events encapsulated between event tags and then prints the output of each event on 1 line each: machinename:~$ sed -n "/<event/,/<\/event>/ {/<result/{s/.*result value=\" \(.*\)\"\/>.*/\1/g; p};...

python logparse search specific text

hi, I am using this function in my code to return the strings i want from reading the log file, I want to grep the "exim" process and return the results, but running the code gives no error, but the output is limited to three lines, how can i just get the output only related to exim process.. #output: {'date': '13', 'process': 'sys...

What syntax sugar or language features makes a language hard/tough to parse?

I did some searching and didn't find a question that "directly" answered this question. Anyway the basic gist of this question is I am wondering what "language feature" or "syntax" that makes a language be a major pain to build a parser, syntax highlighting, etc? This might be subjective but I was thinking of like for example the diffe...

What's the easiest way to parse a string in C?

I have to parse this string in C: XFR 3 NS 207.46.106.118:1863 0 207.46.104.20:1863\r\n And be able to get the 207.46.106.118 part and 1863 part (the first ip address). I know I could go char by char and eventually find my way through it, but what's the easiest way to get this information, given that the IP address in the string coul...

Parsing xml with dom4j or jdom or anyhow

Hello, I wanna read feed entries and I'm just stuck now. Take this for example : http://stackoverflow.com/feeds/question/2084883 lets say I wanna read all the summary node value inside each entry node in document. How do I do that? I've changed many variations of code this one is closest to what I want to achieve I think : Element entry...

Pull specific information from a long list with Perl

The file that I've got to work with here is the result of an LDAP extraction but I need to ultimately get the information formatted over to something that a spreadsheet can use. So, the data is as follows: DataDataDataDataDataDataDataDataDataDataDataDataDataDataDataData DataDataDataDataDataDataDataDataDataDataDataDataDataDataDataData ...

Reading a certificate signing request with c#

Hello, I want to read the contents of a csr in c#, however I haven't found any way to do it in c#. What I've found was the namespace System.Security.Cryptography.X509Certificates, but it only handles existing certificates, not certificate requests:/ Can anyone give me an hint about it? Thanks in advance. Jorge ...

AST with fixed nodes instead of error nodes in antlr

I have an antlr generated Java parser that uses the C target and it works quite well. The problem is I also want it to parse erroneous code and produce a meaningful AST. If I feed it a minimal Java class with one import after which a semicolon is missing it produces two "Tree Error Node" objects where the "import" token and the tokens fo...

Checking when two headers are included at the same time.

Hi, I need to do an assertion based on two related macro preprocessor #define's declared in different header files... The codebase is huge and it would be nice if I could find a place to put the assertion where the two headers are already included, to avoid polluting namespaces unnecessarily. Checking just that a file includes both exp...

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

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. T...

python parsing file json

File json: {"maps":[{"id":"blabla","iscategorical":"0"},{"id":"blabla","iscategorical":"0"}], "masks":["id":"valore"], "om_points":"value", "parameters":["id":"valore"] } I write this script but it only print all the text. json_data=open(file_directory).read() data = json.loads(json_data) pprint(data) How can I parse the file and ...

Replace string with incremented value

Hello, I'm trying to write a CSS parser to automatically dispatch URLs in background images to different subdomains in order to parallelize downloads. Basically, I want to replace things like url(/assets/some-background-image.png) with url(http://assets[increment].domain.com/assets/some-background-image.png) I'm using this insid...

Android SAX parser not getting full text from between tags

I've created my own DefaultHandler to parse rss feeds and for most feeds it's working fine, however, for ESPN, it is cutting off part of the article url due to the way ESPN formats it's urls. An example of a full article url from ESPN.. http://sports.espn.go.com/nba/news/story?id=5189101&amp;amp;campaign=rss&amp;amp;source=ESPNHeadline...

how to parse google search results on iphone

Hi satckoverflow, I am trying to implement a search tool on my iPhone, when i enter a text it will be send to the google for searching. and return the result. I need to know how the text is given to the Google search engine and how the google is returning the result? Is it in the XML format or JSON. I can then parse the result XML/JSO...

PHP Parse Error unexpected '{'

Hi, I'm getting a "Parse error: syntax error, unexpected '{' in line 2". And I don't see the problem. <?php class pointLocation {     var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices     function pointLocation() {     }                   function pointInPolygon($point, $polygon, $pointOnVertex = tru...

Solving a math problem/expression, which is a string, in PHP

The user can enter a math problem (expression) like 5 + 654, 6 ^ 24, 2!, sqrt(543), log(54), sin 5, sin(50). After some reformatting (e.g. change sin 5 into sin(5)), and doing an eval, PHP gives me the right result: $problem = "5 + 5324"; eval("$result = " . $problem); echo $problem . " = " . $result; However, this is quite unsafe: /...