parsing

Modifying PHP files using Perl (possibly using HTML::TreeBuilder)

I am trying to rework many pages across many sites. The pages may contain JavaScript, PHP, or ASP code in addition to HTML. The problem I'm encountering is that the module rewrites things I don't want rewritten. I've managed to handle most of the symbols (e.g., ", >) in HTML tags like script, but they get changed into entities (e.g., &qu...

PHP Parsing URL

Ok, i'm trying to get data from a database to be pulled according to the url. I have a database that is holding data for some announcements for individual customer websites. The websites are in individual directories on my website. (i.e., www.domain.com/website1/index.html, www.domain.com/website2/index.html, www.domain.com/website3/i...

PHP Parse error: parse error, expecting `','' or `')'' ...what to do?

session_start(); if(isset($_SESSION['username'] = $myusername)){ header("location:main_login.php"); } ?> <html> <body> Login Successful </body> </html> On runnig this I get the error Parse error: parse error, expecting `','' or `')'' in C:\wamp\www\a\l\login_success.php on line 4 Can someone help me out with this one, ? ...

Parsing JavaScript argument values in python

Is there a way to parse the argument values passed to a JavaScript function in python? I want to be able to automatically document JavaScript function calls in order to make sure they have the right arguments passed to them. For example, in: function mymethod(fruit, vegetable, drink) { // dummy function } function drink(drink) ...

Operator precendence in boost::spirit?

I made some tests using the spirit mini_c sample. Unfortunately it does not keep the operator precedence as expected: int main() { return 3 > 10 || 3 > 1; } evaluates to 0. return (3 > 10) || (3 > 1); returns 1 I tried to move the definition of "||" and "&&" to the very top in the constructor of template <typename Iterator> ...

php: Parse string from html

I have opend a html file with file_get_contents('http://www.example.com/file.html') and want to parse the line "ParseThis": <h1 class=\"header\">ParseThis<\/h1> As you can see the it's within a h1 tag (the first h1 tag from the html file). How can I get the Text "ParseThis" ? Thanks! ...

Please help me to create parse tree from java and ANTLR

Hi, everybody, Please help me this problem: I do the example on the page: http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760 in order use this example, i have built the grammar P on ANTLRWork 1.4 and generate code to have class PLexer and PParser. But when i run this code on java Jcreator 4.5: import org.antlr.runtime.*; impor...

Find matching bracket with Regex

The input is a string representing a list of elements. A list is defined as an open curly { followed by 0 or more elements separated by whitespace followed by a closed curly }. An element is either a literal or a list of elements. A literal is a succession of non-whitespace characters. If an element contains a curly bracket, it must ...

Parsing CFDUMP struct and store values

How do I parse this structure? I need to turn this into single variables. E.g. from the attributes struct: name type value I'm not familiar with structures, and I need to enter this type of data into a database. I've played around with cfloop, but nothing. ...

parse non-negative doubles

Hi! I need function that will take string and integer that indicates position of non-negative double or integer and return Number or null. If there is '+' return null. Examples 2.1 , 0 -> 2.1 +2.1 , 0 -> null -1 , 0 -> null -1.2 , 1 -> 1.2 qwa56sdf , 3 -> 56 What is the most elegant way to do this? Thanks. upd I ...

String.Split VS. Regex.Split?

If I have a delimited text file with a basic delimiter (say "|" for instance) does it make a difference whether I use a String or a Regex split? Would I see any performance gains with one versus the other? I am assuming you would want to use Regex.Split if you have "escaped" delimiters that you don't want to split on ("\|" for exampl...

Parsing a strangely formatted DateTime. Anyone fancy stepping up?

Hi folks, I'm trying to parse a datestamp (that I got from Twitter) but am receiving errors. here's the datestamp: Fri, 27 Aug 2010 22:00:07 +0000 Here's my code: DateTime.ParseExact(MyDateValue, "ddd, dd MMM YYYY HH:mm:ss +ffff", new CultureInfo("en-US")) and here's my error: System.FormatException was unhandled Mes...

Python: load text as python object

Hi! I have a such text to load: https://sites.google.com/site/iminside1/paste I'd prefer to create a python dictionary from it, but any object is OK. I tried pickle, json and eval, but didn't succeeded. Can you help me with this? Thanks! The results: a = open("the_file", "r").read() json.loads(a) ValueError: Expecting property name: li...

JSON being returned is structures as function call. Can't figure out how to parse with jQuery.

I'm talking to a server and the JSON response looks like this: someResponse({ "Response":{"status":"3","message":"Not valid bla bla"} }); Proper JSON should look like this, right?: { "response": { "status":"3", "message":"Not valid bla bla" } } Is there a way I could somehow reach that data with jQuery i...

[MiKTeX] The TPM file could not be parsed

Hi all, I'm getting this error when I try to Refresh FNDB, update the packages or manage it. How can I solve it? The log is: MiKTeX Problem Report Message: The TPM file could not be parsed. Data: C:\Program Files\MiKTeX 2.8\tpm\packages\pstricks.tpm Source: Libraries\MiKTeX\PackageManager\TpmParser.cpp Line: 390 MiKTeX: 2.8 OS: Micros...

XML parsing failure - [s4s-elt-invalid-content.1]

I'm having problems while parsing a XML file. The XML schema used is: <xsd:complexType name="QuoteFIBondPrice"> <xsd:complexContent> <xsd:sequence> <xsd:element name="BidPrice" type="QuoteFIBondValue" minOccurs="0"/> <xsd:element name="MidPrice" type="QuoteFIBondValue" minOccurs="0"/> <xsd...

Markdown Parsers which support tables in Javasript

Tables in markdown are a lesser known feature and not commonly supported (reddit is currently the only website I know which supports it). Which means any ports of the parsing engine to other languages don't have table's supported. So does anyone know of a library that does this? Or fancy posting a solution to parsing the following synta...

How to use Bison (Yacc) to produce 64bit parser in C++?

Can anyone shed some light on this? From Bison's documentation, I didn't see anything related to this topic. Thanks very much in advance. Mark ...

How to parse of EXIF time stamps with Bash script

As a bash script rookie, detailed answers would be appreciated. :) I am trying to write a bash script that parses JPEG EXIF time stamps output from the exiv2 commmandline utility, which gives me typical output like: Image timestamp : 2010:07:27 17:38:52 Is there a way to parse the time stamp so that its components, like year, mont...

How can I parse this JSON in Android?

I want to pull out the user block. The JSON result will always change, sometimes 4 users will be returned, sometimes 10 etc. { "results": [ { "user": { "avatar_url_thumb": "http://avatars.stocktwits.com/production/9998/thumb-1270014645.png?1270014645", "avatar_url_medium": "http://avatars...