parsing

What RSS parser should I use in PHP?

I am searching an RSS parser written in PHP. The problem is not that I cannot find one. The problem is that there are too many and it's hard to decide which one to use (especially when I have no experience with them and to try them is too time consuming). Can anybody recommend me a "good" RSS parser? The following requirements are impo...

Programmatic interface to Quartz CronExpression?

Is there something in the Quartz libraries that provides programmatic access to the fields in a CronExpression? It seems odd (and rather error-prone) if I can only create a CronExpression with a string to parse instead of with getters and setters ...

Accessing XML attributes with namespaces

How one can access attributes with namespaces? My XML data are in a form val d = <z:Attachment rdf:about="#item_1"></z:Attachment> but the following does not match the attribute (d \\ "Attachment" \ "@about").toString If I remove the namespace component from the attribute's name then it works. val d = <z:Attachment about="#item_1"...

Get note data from MIDI file

Is there a way to get the note data from a MIDI file? That is, I want to break down the MIDI file into its constituent parts so they are in the form of a unique word (or any other data type). What I want to do in the end is take in a MIDI file and find patterns in the notes. Get in each note, find it's frequency (of being played) and n...

Packrat parsing vs. LALR parsing

A lot of websites states that packrat parsers can parse input in linear time. So at the first look they me be faster than LALR parser contructed by the tools yacc or bison. I wanted to know if the performance of packrat parsers is better/worse than the performance of LALR parser when tested with common input (like programming language s...

Shunting Yard implementation in PHP needed, interpret and parse a string perform a mathematical comparison and return a boolean result

Hi, I'm looking for something that can interpret a string in php and perform simple math calculation, and then return a boolean result as to whether the expression is true or false. For example: Sue types in "3*{mysalary}/9=10000" PHP splits this up into two expressions - explode('=',string); PHP takes my list of database fields, and...

Parse line of text

Hi all, I have thousands of text files, and each file contains just a single line of text. Any single file looks like this: somevalue1|somevalue2|somevalue3|somevalue4|somevalue5 The format never changes, and from above, you can see how each value is separated by a "|". And there are always exactly 5 values in each file. Can someon...

Scala StandardTokenParsers vs JavaTokenParsers

What exactly is the difference between StandardTokenParsers and JavaTokenParsers? What is one good for and what is the other good for? In StandardTokenParsers I can define my keywords using lexical.reserved, but how exactly does that help me? BR Troels ...

How to get all feature in a range from a GFF3 file in Perl?

I would like to write a Perl function that gets a GFF3 filename and a range (i.e. 100000 .. 2000000). and returns a reference to an array containing all names/accessions of genes found in this range. I guess using bioperl will make sense, but I have very little experience with it. I can write a script that parses a GFF3 by my self, but ...

How to get flv duration in java?

Given a flv file, how do I get the video duration in java code? That is, how to parse the flv header to get the video duration? Note: I've found this other question, but the answer is about getting the file header content from a given url and not about parsing that header. ...

C#- Getting error when trying to parse user input to int

Hi, I am new to c#, and I can't figure out why I keep getting a 'FormatException was unhandled' error when I run this method: public void bet() { int betAmount; Console.WriteLine("How much would you like to bet?"); betAmount = int.Parse(Console.ReadLine()); Console.WriteLine(_chips - betAmount); } The program does no...

how to parse a time value of "400" (equivalent to 4:00) using DateTime.TryParseExact

I'm trying to convert user entered times into TimeSpans. Because TimeSpan does not have a TryParseExact method I'm using the one in DateTime and converting the output from it. The formats I want to handle are: 04:00, 0400, 4:00, and 400. The first three aren't a problem and correspond to the first three cases in the if/else structur...

How do I submit a boolean parameter in Rails?

I'm submitting a parameter show_all with the value true. This value isn't associated with a model. My controller is assigning this parameter to an instance variable: @show_all = params[:show_all] However, @show_all.is_a? String, and if @show_all == true always fails. What values does Rails parse as booleans? How can I explicitly spe...

Java text parsing help needed with section name/content text

I have text in the following format: section name 1: this text goes into the first section section name 2: this text goes into the second section etc, Where section names are arbitrary phrases and section contents will contain free text except section name. I need to split this text into object pairs of type (s...

HTML Parsing in web browsers?

Hi, I’m a beginner and I’m wandering for this question. Right now I’m concerned with webkit (a web browser). Here, my problem is, what I want to know, how the web browser is handling all the HTML data coming from any network. E.g. how is it getting the data and parsing that? Very specifically, I want to know about HTML Parser! If you hav...

I am looking for a Java alternative of "Google code prettifier"

I would like to do exactly what "google code prettifier" (syntax highlighting of code snippets in a web page) does, but on serverside using java. Any ideas? ...

Which interface should I implement to have parse method

Hi, I'm working with webservices. I have a java object defined for the request. I'd like to create a java object of this type from a String or a XmlObject. Which interface should I implement to use the method parse to do this? Thanks and regards ...

How to use a javascript function in a pure php page.

Howdy y'all, I am looking for a way to include a .js function with in a straight php page. By straight php I mean there is no html included. Explanation of process if you will. I have a page where employees must swipe their ID badge for access to a computer. The employee swipes the badge, the magnetic strip is read, and the data sti...

Parsing the url querystring using jquery and inserting the value in a textbox?

post.php?replyto=username&othervariable=value For example, if I click a link with this url, then I want to take the replyto=username value and insert the value in a textbox using jquery. function insertParamIntoField(url, param, field) { var anchor = document.createElement('a'), query; anchor.value = url; query =...

How to verify a Hyperlink exists on a webpage?

I have a need to verify a specific hyperlink exists on a given web page. I know how to download the source HTML. What I need help with is figuring out if a "target" url exists as a hyperlink in the "source" web page. Here is a little console program to demonstrate the problem: public static void Main() { var sourceUrl = "http://dev...