parsing

jQuery + parseDouble problem

I have an AJAX-request that returns a json object containing a few values with two decimals each, but since it's json these values are strings when returned. What I need to do is to perform addition on these values. Just a simple a+b = c, but they concatenate instead becoming ab. I was hoping I could use parseDouble in jQuery just like...

Determine the latest content in an email.

The problem: Random e-mail from different clients are received in my MS Exchange mailbox, I am not concerned with previous content rather the latest text of the message and would like to extract it. This is currently developed as C# managed Exchange sink obtain these messages but I cannot devise a straightforward method to reliably par...

Is there a faster way to check for an XML Element in LINQ to XML?

Currently I'm using the following extension method that I made to retrieve the values of elements using LINQ to XML. It uses Any() to see if there are any elements with the given name, and if there are, it just gets the value. Otherwise, it returns an empty string. The main use for this method is for when I'm parsing XML into C# objec...

Is there a faster way to check for an XML Element in LINQ to XML, and parse a bool?

FYI, This is very similar to my last question: Is there a faster way to check for an XML Element in LINQ to XML? Currently I'm using the following extension method that I made to retrieve the bool values of elements using LINQ to XML. It uses Any() to see if there are any elements with the given name, and if there are, it parses the val...

Parsing a website and getting the info I need

hi so I need to retrieve the url for the first article on a term I search up on nytimes.com So if I search for Apple. This link would return the result http://query.nytimes.com/search/sitesearch?query=Apple&srchst=cse And you just replace Apple with the term you are searching for. If you click on that link you would see that NYti...

Best practice to parse html (not XML) to XElement?

I have this code: var url = textBox1.Text; WebClient wc = new WebClient(); var page= wc.DownloadString(url); XElement doc = XElement.Parse(page); It fails with exception about unexpected characters. Obviously, the HTML i'm trying to parse in such a dumb way is not strict xml. What's the next easiest way to parse arbitrary HTML to som...

Is there a faster way to check for an XML Element in LINQ to XML, and parse an int?

FYI, This is very similar to my last question: Is there a faster way to check for an XML Element in LINQ to XML, and parse a bool? Currently I'm using the following extension method that I made to retrieve the int values of elements using LINQ to XML. It uses Any() to see if there are any elements with the given name, and if there are, ...

How do you extract data from vendor website in vbscript?

I have programmed a post image HTA which is launched after an XP image has been loaded onto a computer. The HTA gathers information from the user (ie primary user name, department, etc) and updates the registry under a custom key. Management has asked if I can pull the computer's warranty information (specifically the warranty end date) ...

Test to fail this DateTime parsing in C#?

Hi, I have an issue with parsing a date during a unit test run, but I cannot reproduce it. To make it more interesting it fails when the test is run by a continuous integration process but succeeds when run within Visual Studio, and they both run on the same machine, although with a different user. Here's the test: [Test] public void T...

Using $n for n < 0 in Bison

Is there a way in Bison to check the current token stack size? I'd like to use $n with n as a negative number to access a semantic value of another rule but only if the stack is large enough. Thank you. ...

Simple XML reading question (PHP)

Hello, I have the following XML file: <?xml version="1.0" encoding="utf-8"?> <SearchResults:searchresults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zillow.com/static/xsd/SearchResults.xsd /vstatic/279989c5e93d519f8d8f23d3f6cac661/static/xsd/SearchResults.xsd" xmlns:SearchResults="http://www...

NSTokenField autocomplete

Hi, I'm creating an application which uses an NSTokenField. I need autocompletion. I'm using an NSURLRequest to request data from http://stackoverflow.com/filter/tags?_=&lt;timestamp&gt;&amp;limit=6&amp;q=&lt;str_to_autocomplete&gt;&amp;timestamp=&lt;timestamp&gt; Where <timestamp> is the current timestamp, an <str_to_autocomplete> is ...

LALR(1) empty list of parameters for functions

Hi I have a simple LALR(1) grammar, but I'm encountering a problem. start ::= spec. spec ::= MOD STRING top_stmt. spec ::= top_stmt. top_stmt ::= stmt. top_stmt ::= conditional. stmt ::= expr. stmt ::= assignment. conditional ::= IF stmt_list. expr ::= retval. expr ::= NOT retval. retval ::= access. retval ::= invoke. access ::= ns_ide...

Encapsulating a (pure Ruby) Ragel parser for infinite streams?

I want to parse a continuous stream of bytes (from a socket) with a state machine using Ragel However, all the Examples I have found are either parsing a complete file in one pass (like the Gherkin lexer or are using Ragels C Target (like the mongrel HTTP1.1 Parser) I'm looking for some advice or examples on how to instantiate a Ragel ...

String expression parsing tips?

I got bored during the holiday season this year and randomly decided to write a simple list comprehension/filtering library for Java (I know there are some great ones out there, I just wanted to write it my self for the hell of it). For this list: LinkedList<Person> list = new LinkedList<Person>(); list.add(new Person("Jac...

Removing inline elements when importing HTML into DOMDocument or SimpleXML?

I have an external HTML source that I want to scrape and either transform into a local XML file or add to a MySQL DB. The external source is mostly normalized and (somewhat) semantic, so that all I need to do is use XPATH to get all td content or all li content, etc. The problem is that occasionally these items use <strong> or <b> or <i...

error php domDocument xml parsing

Hi, Does anybody know how I can get this xml into the domDocument? Right now, it throws an error saying it is missing a top level element. What I see is that feed is the toplevel element, so it's a mystery to me. This only happens if I run it threw the domDocument and not when I echo it out directly. The xml validator also gives no err...

parse a character out of a string in javascript

if i have a number of string like this var info = "Information4Table" var next = "Joe5Table" var four = "ERweer11Table" var nice = "ertertertn14Table" and i want to parse out the number between the first word and the string "Table". So for the first item, i want to get "4" and in the last i would want to get "14". what would be the ...

Parse arbitary user input

I have a database full of messages from a bulletin board. The board uses BB codes as formatting style. I.e.: I'm not formatted This is [b]bold[/b] text Tags can also [i][b]be[/b] nested[/i] And the [b]nesting [i]can be[/b] rather[/i] ugly My ultimate goal is to convert these messages to some well formed XML (no discussion here ;) ). ...

Binary files parsing libraries for .NET

Hi. Recently I had a task to make a binary files parser, however it was the first time of using C#/.NET for this kind of problems. It was really simple to parse and extract data from the required binary files because of their simple structure (though I have to say it was unusual rather than the simple way C/C++; also as far as I digged ...