parsing

Java how can I add an accented "e" to a string?

Hello, With the help of tucuxi from the existing post Java remove HTML from String without regular expressions I have built a method that will parse out any basic HTML tags from a string. Sometimes, however, the original string contains html hexadecimal characters like (which is an accented e). I have started to add functionality which...

Ruby Rss parser and event trigger

I'm using RSS library so i can parse Atom and RSS in Ruby and Rails and store it in a model. I've looked at the standard RSS library, but is there one library that will auto-detect that there is a new rss feed so i can update my database ? what are the best practice to trigger an instruction in order to store the new rss feed ? should ...

lr parsing table

Could any1 explain how can i transform ll(1) parsing table to lr(1) parsing table? Or are there any tables already for lr1 mathematical parsing(+,-,/,*,^)? ...

Parsing a file in C

I need parse through a file and do some processing into it. The file is a text file and the data is a variable length data of the form "PP1004181350D001002003..........". So there will be timestamps if there is PP so 1004181350 is 2010-04-18 13:50. The ones where there are D are the data points that are three separate data each three dig...

Trouble parsing NMEA data from Serial Port.

I'm retrieving NMEA sentences from a serial GPS. Then string are coming across like I would expect. The problem is that when parsing a sentence like this: $GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,,*1A I use a simple bit of code to make sure I have the right sentect: string[] Words = sBuffer.Split(','); ...

BB Code Parser (in formatting phase) with jQuery jammed due to messed up loops most likely

Greetings everyone, I'm making a BB Code Parser but I'm stuck on the JavaScript front. I'm using jQuery and the caret library for noting selections in a text field. When someone selects a piece of text a div with formatting options will appear. I have two issues. Issue 1. How can I make this work for multiple textfields? I'm drawing a b...

php parse without replacing

i have seen some parsing code, thats really long, but it doesn't involve replacing stuff inside an opened file using file_get_contents() for example. im talking about say parsing a .doc into .html format, they read the file then output it in html. i have tried this using arrays and preg_replace but it just doesn't seem as clean as other ...

A database of questions with unambiguous numeric answers.

I (and co-hackers) are building a sort of trivia game inspired by this blog post: http://messymatters.com/calibration. The idea is to give confidence intervals and learn how to be calibrated (when you're "90% sure" you should be right 90% of the time). We're thus looking for, ideally, thousands of questions with unambiguous numerical an...

Parsing a CSV File to a Rails Database

G'day guys, I'm using fasterCSV and a rake script to parse a csv with about 30 columns into my rails db for a 'Trade' item. The script works fine when all of the values are set to strings, but when I change it to a decimal, int or other value, everything goes to hell. Wondering if fasterCSV has built in int etc parsing or whether I'll ...

fastercsv parsing to int or other into ActiveRecord

I'm currently importing a CSV into an activerecord element but can't choose to parse the elements as say ints or decimals on a case by case basis using fastercsv. I can either choose to parse everything as an int or the other, or all as strings. I need to parse some columns as ints, some as decimals and some as strings. Otherwise, is th...

Parsing to a total DateTime object in Rails

I'm currently given three values in a table A date value in the format of %dd-%mname-%yy (i.e 06-may-05), and am parsing that using Date.parse(input,true) to fix the issue with the leading values. I'm then given a time value in the form of %hh:%mm:%ss.%ms (the ms of which I can take or leave) and a third value of a GMT offset. I can't...

jquery - get url path?

I know I can use window.location.pathname to return a url, but how do I parse the url? I have a url like this: http://localhost/messages/mine/9889 and I'm trying to check to see if "mine" exists in that url? So, if "mine" is the second piece in that url, I want to write an if statement based on that... if(second argument == 'mine')...

C++: parsing with simple regular expression or shoud I use sscanf?

I need to parse a string like func1(arg1, arg2); func2(arg3, arg4);. It's not a very complex parsing problem, so I would prefer to avoid resorting to flex/bison or similar utilities. My first approch was to try to use POSIX C regcomp/regexec or Boost implementation of C++ std::regex. I wrote the following regular expression, which does ...

Parsing date in Pascal

Hello, what's the better way of parsing date in Pascal than manually parsing character after character? Date should be in mm.dd.yyyy format. ...

Ignoring characters in a file while parsing

i need to parse through a text file and process the data. the valid data is usually denoted by either a timestamp with TS followed by 10 numbers (TS1040501134) or values with a alpabet followed by nine numbers (A098098098)...so it will be like TS1040501134A111111111B222222222...........TS1020304050A000000000........ However, there are c...

Parsing files "/etc/default" using java

I'm trying to parse the configuration files usually found in /etc/default using java and regular expressions. So far this is the code I have iterating over every line on each file: // remove comments from the line int hash = line.indexOf("#"); if (hash >= 0) { line = line.substring(0, hash); } // create the patterns Pattern double...

how to extract information from JSON using jQuery

Hi, I have a JSON response that is formatted from my C# WebMethod using the JavascriptSerializer Class. I currently get the following JSON back from my query: {"d":"[{\"Lat\":\"51.85036\",\"Long\":\"-8.48901\"},{\"Lat\":\"51.89857\",\"Long\":\"-8.47229\"}]"} I'm having an issue with my code below that I'm hoping someone might be able...

JSP compilation error upon changing XML parser to Xerces

All, I'm working on a java webapp that we deploy in the Resin web app server. I have been doing some XML parsing for a new part of the application, and realized that our app was using Resin classes to do the parsing. I wanted to get away from that and use something more standard for a number of reasons, so I set these system properti...

parsing msinfo32 report file with different language settings

Hey guys, i started to write a mini diagnostic tool for a few friends of mine. I want to collect system information via msinfo32.exe and using the report switch, so i can write a normal txt file. After that, i want to remove some categories (e.g. error reporting and start menu, because it is so much stuff), but I ran into some problems ...

How to transform a production to LL(1) for a list separated by a semicolon?

Hi, I'm reading this introductory book on parsing (which is pretty good btw) and one of the exercice is to "build a parser for your favorite language." Since I don't want to die today, I thought I could do a parser for something relatively simple, ie a simplified CSS. Note: This book teach you how to write a LL(1) parser using the recur...