Search Results

Search found 3176 results on 128 pages for 'parsing'.

Page 90/128 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • How to parse an XML file using PHP?

    - by Jack
    Here I have a variable 'response' which is obtained by parsing an XML file. $url = 'http://xxxxx.xml'; $ch = curl_init($url); $response = curl_exec($ch); The url structure is as follows - <user> <id>734</id> <name>Peter Parker</name> - <status> <favorited>false</favorited> </status> </user> How to access each bit of info like id,name,favorited from response?

    Read the article

  • Java: how to initialize int without assigning a value?

    - by HH
    $ javac InitInt.java InitInt.java:9: '[' expected right = new int; ^ InitInt.java:9: ']' expected right = new int; ^ InitInt.java:13: ';' expected } ^ InitInt.java:14: ';' expected public int getRight(){return right;} ^ InitInt.java:15: reached end of file while parsing } ^ 5 errors $ cat InitInt.java import java.util.*; import java.io.*; public class InitInt { private final int right; public static void main(String[] args) { // I don't want to assign any value. // just initialize it, how? right = new int; // later assiging a value } public int getRight(){return right;} }

    Read the article

  • ASP.Net Cross Page Posting

    - by John
    Currently I have two pages: The first page contains an input form, and the 2nd page generates an excel document. The input form's button posts to this 2nd page. What I'd like to do is add a second button which also posts to the 2nd page; however, I'll need requests created from this new button to act differently, which brings me to my question: Is there a way I can tell, from the 2nd page, which button was pressed to submit the request? The main reason I'm asking is I'd like to re-use the 2nd page's logic in parsing the information from the first page if possible; I'd rather not have to copy it to a new page and have the new button post to that. Thanks!

    Read the article

  • JQuery XML option node

    - by JD
    hi, I am having an issue with parsing XML with JQuery when there is a node with an option node <preferences><dashboard> <report id="si_pg_vw" order="0"> <header> <data> <option type="reportname" value="Page View"/> </data> </header> </report> the following code in firebug returns no children $reportElement.find("data")[0] however if I change option to any other value ("option2", "test" etc) then the line above returns one child which is correct. Am I mising something or is there a bug? Thanks John

    Read the article

  • Possible to view T-SQL syntax of a stored proc-based SqlCommand?

    - by mconnley
    Hello! I was wondering if anybody knows of a way to retrieve the actual T-SQL that is to be executed by a SqlCommand object (with a CommandType of StoredProcedure) before it executes... My scenario involves optionally saving DB operations to a file or MSMQ before the command is actually executed. My assumption is that if you create a SqlCommand like the following: Using oCommand As New SqlCommand("sp_Foo") oCommand.CommandType = CommandType.StoredProcedure oCommand.Parameters.Add(New SqlParameter("@Param1", "value1")) oCommand.ExecuteNonQuery() End Using It winds up executing some T-SQL like: EXEC sp_Foo @Param1 = 'value1' Is that assumption correct? If so, is it possible to retrieve that actual T-SQL somehow? My goal here is to get the parsing, etc. benefits of using the SqlCommand class since I'm going to be using it anyway. Is this possible? Am I going about this the wrong way? Thanks in advance for any input!

    Read the article

  • Why am I getting this WSDL SOAP error with authorize.net?

    - by Chad Johnson
    I have my script email me when there is a problem creating a recurring transaction with authorize.net. I received the following at 5:23AM Pacific time: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.authorize.net/soap/v1/service.asmx?wsdl' : failed to load external entity "https://api.authorize.net/soap/v1/service.asmx?wsdl" And of course, when I did exactly the same thing that the user did, it worked fine for me. Does this mean authorize.net's API is down? Their knowledge base simply sucks and provides no information whatsoever about this problem. I've contacted the company, but I'm not holding my breath for a response. Google reveals nothing. Looking through their code, nothing stands out. Maybe an authentication error? Has anyone seen an error like this before? What causes this?

    Read the article

  • inserting std::strings in to a std::map

    - by PaulH
    I have a program that reads data from a file line-by-line. I would like to copy some substring of that line in to a map as below: std::map< DWORD, std::string > my_map; DWORD index; // populated with some data char buffer[ 1024 ]; // populated with some data char* element_begin; // points to some location in buffer char* element_end; // points to some location in buffer > element_begin my_map.insert( std::make_pair( index, std::string( element_begin, element_end ) ) ); This std::map<>::insert() operation takes a long time (It doubles the file parsing time). Is there a way to make this a less expensive operation? Thanks, PaulH

    Read the article

  • appcelerator titanium cannot parse JSON

    - by Richard
    Hi, I'm new to titanium and get difficulty in parsing JSON from mysql export. the json is valid and I feel frustrated with many unsuccessful trials. To simplify the code, I put it below. The code just stop and said: [ERROR] Script Error = Unable to parse JSON string var win = Titanium.UI.currentWindow; var hotdealjson = "{'hotdeal':[{'place':'bangkok','date':'4D3N','cost':'$4999up'},{'place':'tokyo','date':'3D2N','cost':'$3799up'}]}"; //read json var response = JSON.parse(hotdealjson); alert(response.hotdeal.length); Thanks & regards, Richard

    Read the article

  • Determine if a url matches a Route, and pull out the terms if it does

    - by Kevin Montrose
    I've got a big old log file I'm trying to break down in terms of routes. Essentially, I'm getting input of a path (/questions/31415 for example) and a list of all the registered Routes. What I want out is a Route and the parameters specified in the route (so in, /questions/{id}/{answer} I'd get id and answers out). I've got a working solution that basically generates a nasty bit of regex on the fly with named groups to do matching and parsing all-in-one. My gut tells me this is a brittle way to do it, and frankly there has to be a better way, right?

    Read the article

  • How can I capture multiple matches from the same Perl regex?

    - by Sho Minamimoto
    I'm trying to parse a single string and get multiple chunks of data out from the same string with the same regex conditions. I'm parsing a single HTML doc that is static (For an undisclosed reason, I can't use an HTML parser to do the job.) I have an expression that looks like: $string =~ /\<img\ssrc\="(.*)"/; and I want to get the value of $1. However, in the one string, there are many img tags like this, so I need something like an array returned (@1?) is this possible?

    Read the article

  • Programmatic resource monitoring per process in Linux

    - by tuxx
    Hi, I want to know if there is an efficient solution to monitor a process resource consumption (cpu, memory, network bandwidth) in Linux. I want to write a daemon in C++ that does this monitoring for some given PIDs. From what I know, the classic solution is to periodically read the information from /proc, but this doesn't seem the most efficient way (it involves many system calls). For example to monitor the memory usage every second for 50 processes, I have to open, read and close 50 files (that means 150 system calls) every second from /proc. Not to mention the parsing involved when reading these files. Another problem is the network bandwidth consumption: this cannot be easily computed for each process I want to monitor. The solution adopted by NetHogs involves a pretty high overhead in my opinion: it captures and analyzes every packet using libpcap, then for each packet the local port is determined and searched in /proc to find the corresponding process. Do you know if there are more efficient alternatives to these methods presented or any libraries that deal with this problems?

    Read the article

  • "Arbitrary" context free grammars?

    - by danwroy
    Long time admirer first time inquirer :) I'm working on a program which derives a deterministic finite-state automata from a context-free grammar, and the paper I have been assigned which explains how to do this keeps referring to "arbitrary probabilistic context-free grammars" but never defines the meaning of "arbitrary" in relation to PCFGs. I assume they mean "any old PCFG" but then why not just say "any PCFG"? The term also turns up in several Wikipedia entries. At the top of the CFG page there is a reference to arbitrariness in relation to CFGs on ("clauses can be nested inside clauses arbitrarily deeply"), but doesn't make clear why someone would refer to a PCFG or subset of PCFGs as arbitrary. In case anyone is curious, the paper is Parsing and Hypergraphs by Klein and Manning (2001); I've also been reading two other papers by them related to this one (An Agenda-Based Chart Parser for Arbitrary Probabilistic Context-Free Grammars and Empirical Bounds, Theoretical Models, and the Penn Treebank) which use the term extensively but never explain it either. Thanks for your help!

    Read the article

  • ASP:LinkButton and Eval

    - by sgibbons
    I'm using an ASP:LinkButton inside of an ItemTemplate inside of a TemplateField in a GridView. For the command argument for the link button I want to pass the ID of the row from the datasource that the gridview is bound to, so I'm doing something like this: <asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="<%#Eval("ID")%>" Text="View Log" runat="server"/> Unfortunately, the resulting HTML is this: <asp:LinkButton ID="viewLogButton" CommandName="viewLog" CommandArgument="3" Text="View Log" runat="server"/> It seems that it is parsing the Eval() properly, but this is somehow causing it not to parse the LinkButton tag and just dump it out as literal text. Does anyone know: a) why this is happening and, b) what a good solution to this problem is?

    Read the article

  • Double encoded url being fully decoded in ASP.NET

    - by Brad R
    I have just come across something that is quite strange and yet I haven't found any mention on the interwebs of others having the same problem. If I hit my ASP.NET application with a double encoded url then the Request["myQueryParam"] will do a double decode of the query for me. This is not desirable as I have double encoded my query string for a good reason. Can others confirm I'm not doing something obviously wrong, and why this would happen. A solution to prevent it, without doing some nasty query string parsing, would be great too! As an example if you hit the url: http://localhost/MyApp?originalUrl=http%3a%2f%2flocalhost%2fAction%2fRedirect%3fUrl%3d%252fsomeUrl%253futm_medium%253dabc%2526utm_source%253dabc%2526utm_campaign%253dabc (For reference %25 is the % symbol) Then look at the Request["originalUrl"] (page or controller) the string returned is: http://localhost/Action/Redirect?Url=/someUrl?utm_medium=abc&utm_source=abc&utm_campaign=abc I would expect: http://localhost/Action/Redirect?Url=%2fsomeUrl%3futm_medium%3dabc%26utm_source%3dabc%26utm_campaign%3dabc I have also checked in Fiddler and the URL is being passed to the server correctly (one possible culprit could have been the browser decoding the URL before sending).

    Read the article

  • MarkupBuilder using list

    - by tathamr
    I am currently using sql.row("statement") and storing to a list. I then am trying to setup my xml file using MarkupBuilder. Is there a better way than iterating over the list poping off an item and then parsing it to add my different column names and values? What is stored by list entry is ID='X' Period='Yearly' Lengh='test' So the XML would be something similar to: <table name='test'> <row> <column name=ID>X</column> <column name=Period>Yearly</column> <column name=Length>test</column> </row> </table>

    Read the article

  • Two '==' equality operators in same 'if' condition are not working as intended.

    - by Manav MN
    I am trying to establish equality of three equal variables, but the following code is not printing the obvious true answer which it should print. Can someone explain, how the compiler is parsing the given if condition internally? #include<stdio.h> int main() { int i = 123, j = 123, k = 123; if ( i == j == k) printf("Equal\n"); else printf("NOT Equal\n"); return 0; } Output: manav@workstation:~$ gcc -Wall -pedantic calc.c calc.c: In function ‘main’: calc.c:5: warning: suggest parentheses around comparison in operand of ‘==’ manav@workstation:~$ ./a.out NOT Equal manav@workstation:~$ EDIT: Going by the answers given below, is the following statement okay to check above equality? if ( (i==j) == (j==k))

    Read the article

  • How to decoding the string in iphone

    - by Pugal Devan
    Hi, I want to decode my string. I have used parsing and get a string from RSS feed. In a string these special characters are not allowed &,<, in my app. So server side encoding those characters and give it to the string. So now i got the string like, Actual String : <Tom&Jerry> (only these characters are not allowed in node data & < >). After Encoding: %3CTom%26Jerry%3E. But i need to display the string is <Tom&Jerry> So how can i decode the string. Please help me out. Thanks.

    Read the article

  • Unescape _xHHHH_ XML escape sequences using Python

    - by John Machin
    I'm using Python 2.x [not negotiable] to read XML documents [created by others] that allow the content of many elements to contain characters that are not valid XML characters by escaping them using the _xHHHH_ convention e.g. ASCII BEL aka U+0007 is represented by the 7-character sequence u"_x0007_". Neither the functionality that allows representation of any old character in the document nor the manner of escaping is negotiable. I'm parsing the documents using cElementTree or lxml [semi-negotiable]. Here is my best attempt at unescapeing the parser output as efficiently as possible: import re def unescape(s, subber=re.compile(r'_x[0-9A-Fa-f]{4,4}_').sub, repl=lambda mobj: unichr(int(mobj.group(0)[2:6], 16)), ): if "_" in s: return subber(repl, s) return s The above is biassed by observing a very low frequency of "_" in typical text and a better-than-doubling of speed by avoiding the regex apparatus where possible. The question: Any better ideas out there?

    Read the article

  • Visual Studio error on valid SQL

    - by Sam
    I'm getting an annoying error in visual studio for SQL that executes fine. SELECT InvoiceLines.LineID, InvoiceLines.InvoiceID, InvoiceLines.Text, InvoiceLines.Rate, InvoiceLines.Count, InvoiceLines.Rate * InvoiceLines.Count AS LineTotal, ((InvoiceLines.Rate * InvoiceLines.Count) * (1 + Invoices.VatRate / 100)) * (1 - CAST(Invoices.Discount AS money) * InvoiceLines.ApplyDiscount / 100) AS LineTotalIncVat, InvoiceLines.ApplyDiscount FROM InvoiceLines LEFT JOIN Invoices ON Invoices.InvoiceID = InvoiceLines.InvoiceID What LineTotalIncVat is trying to do is compute the total for the invoice item while adding the vat and subtracting the discount, and yes, probably better to do this in code (would if I could) The error visual studio gives is: There was an error parsing the query [token line number =1, token line offset =14, token in error = InvoiceLines] Even though it will validate and execute without a problem in the query builder...

    Read the article

  • xmlCtxtGetLastError - Iphone

    - by Raphael Kohn
    Hi, I have been programming with NSXMLParser for quite a while and lately, I came out with this error. The strangiest thing is that it only happens in debug mode. Once I load the App in Simulator and run it from Simulator (without Xcode involved), it runs fine. The code is very straight foward, it is a simple XML parsing whose contents were loaded from the web in a separated thread. Does anybody have alredy encoutered that error?? Thanks in advance.

    Read the article

  • .NET Regular expressions on bytes instead of chars

    - by brickner
    Hi, I'm trying to do some parsing that will be easier using regular expressions. The input is an array (or enumeration) of bytes. I don't want to convert the bytes to chars for the following reasons: Computation efficiency Memory consumption efficiency Some non-printable bytes might be complex to convert to chars. Not all the bytes are printable. So I can't use Regex. The only solution I know, is using Boost.Regex (which works on bytes - C chars), but this is a C++ library that wrapping using C++/CLI will take considerable work. How can I use regular expressions on bytes in .NET directly, without working with .NET strings and chars? Thank you.

    Read the article

  • Link all'interno di un campo testo

    - by aleds
    Ciao a tutti, nella Rails app che sto realizzando, l'utente ha la possibilita' di inserire un post (campo memo) con all'interno una URL. Ad esempio: "bla bla bla bla www.blabla.com bla bla bla ..." Nel mostrare tale post vorrei che www.blabla.com diventasse un link cliccabile (come avviene in twitter). Ovviamente deve essere fatto un parsing della url, immagino usando le espressioni regolari. Avete dei consigli in merito ? Esiste qualcosa di gia' fatto oppure inizio da subito a scrivere il codice :) ? Grazie Alessandro DS http://alex-on-rails.blogspot.com/

    Read the article

  • Perl Regex Multiple Items in Single String

    - by Sho Minamimoto
    I'm trying to parse a single string and get multiple chunks of data out from the same string with the same regex conditions. I'm parsing a single HTML doc that is static (For an undisclosed reason, I can't use an HTML parser to do the job.) I have an expression that looks like $string =~ /\<img\ssrc\="(.*)"/; and I want to get the value of $1. However, in the one string, there are many img tags like this, so I need something like an array returned (@1?) is this possible?

    Read the article

  • Java (Android) regular expression to strip out HTML paragraph

    - by jackbot
    I have an Android application which grabs some data from an external XML source. I've stripped out some HTML from one of the XML elements, but it's in the format: <p class="x">Some text...</p> <p>Some more text</p> <p>Some final text</p> I want to extract the middle paragraph text, how can I do this? Would a regular expression be the best way? I don't really want to start including external HTML parsing libraries.

    Read the article

  • convert xml.documentElement.getElementsByTagName("marker")[index].getAttribute(temp) to string in ja

    - by user324884
    I am parsing xml file in javascript and after that want to cancatenate all the the data into string. but failing to do the same and it is returning undefined. GDownloadUrl("./include/dataemp2.xml", function(data) { var xml = GXml.parse(data); markers = xml.documentElement.getElementsByTagName("marker"); for(var t=0;t<18;t++) { var temp= markers[index].getAttribute("address"); html = html + temp; } }); it is returning as undefined because temp is not concatenating in "html"; whereas when i do this like html = html +markers[index].getAttribute("address"); it is giving me expected output;

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >