Search Results

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

Page 60/128 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • what is the procedure of performing wsdl parsing in iphone?

    - by Ankit Vyas
    i have performed like this Is there any thing wrong performed by me? NSURL *url = [NSURL URLWithString:@"http://111.111.111.111/BattleEmpire.Service/ApplicationService.svc?wsdl"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; [theRequest setHTTPMethod:@"GET"]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(theConnection) { webData = [[NSMutableData data] retain]; NSLog( @"connection established"); } else { NSLog(@"theConnection is NULL"); }

    Read the article

  • Should I strip the XML declaration from suds output before parsing with lxml?

    - by mikl
    I’m trying to implement a SOAP webservice in Python 2.6 using the suds library. That is working well, but I’ve run into a problem when trying to parse the output with lxml. Suds returns a suds.sax.text.Text object with the reply from the SOAP service. The suds.sax.text.Text class is a subclass of the Python built-in Unicode class. In essence, it would be comparable with this Python statement: u'<?xml version="1.0" encoding="utf-8" ?><root><lotsofelements \></root>' Which is incongrous, since if the XML declaration is correct, the contents are UTF-8 encoded, and thus not a Python Unicode object (because those are stored in some internal encoding like UCS4). lxml will refuse to parse this, as documented, since there is no clear answer to what encoding it should be interpreted as. As I see it, there are two ways out of this bind: Strip the <?xml> declaration, including the encoding. Convert the output from Suds into a bytestring, using the specified encoding. Currently, the data I’m receiving from the webservice is within the ASCII-range, so either way will work, but both feels very much like ugly hacks to me, and I’m not quite sure what would happen, if I start to receive data that would need a wider range of Unicode characters. Any good ideas? I can’t imagine I’m the first one in this position…

    Read the article

  • MVC2 IModelBinder and parsing a string to an object - How do I do it?

    - by burnt_hand
    I have an object called Time public class Time{ public int Hour {get;set;} public int Minute {get;set;} public static Time Parse(string timeString){ //reads the ToString()'s previous output and returns a Time object } override protected string ToString(){ //puts out something like 14:50 (as in 2:50PM) } } So what I want is for the automatic model binding on the Edit or Create action to set this Time instance up from a string (i.e. feed the Parse method with the string and return the result). The reason I am doing this is that I will have a DropDownList with selectable times. The value of each option will be the parser readable string. Can anyone provide an example BindModel method from the IModelBinder interface?

    Read the article

  • XSL: Parsing XML to HTML - How do I use value-of an element data as an html attribute?

    - by AtomR
    <input src="LOGO.JPG" type="image" name="imagem"> I have an xml element that contains the image path that needs to be displayed in HTML after the parse. <xsl:value-of select="image"/> returns the string that is stored in the image element but how can I use it to make that string be the src atribute value in an html tag? I tried <input src="<xsl:value-of select="image"/>" type="image" name="imagem"> but obviously that doesn't work so how can it be done? I hope I was clear in my question. Please help!

    Read the article

  • Does Restlet support parsing URLs into calling methods with parameters?

    - by John C
    Take the following example. I have a resource public class HelloWorldResource extends ServerResource { @Get public String represent(String arg) { return "hello, world (from the cloud!)" + arg; } } That is mapped by router.attach("/hi/{message}", HelloWorldResource.class); Is it possible to configure the routing such that accessing /hi/somestuffhere will make restlet fill in the arg parameter in the represent method?

    Read the article

  • Advance: Parsing XML into another XML page using only javascript or jquery; Can't use PhP, Java or MySQL

    - by UrBestFriend
    Current site: http://cardwall.tk/ Example of intended outcome: http://www.shockwave.com/downloadWall.jsp I have an embeded flash object that uses XML/RSS (Picasa) to feed itself pictures. Now I created my own XML/RSS feed so that I can add additional XML tags and values. Now here's my big problem: enabling search. Since I'm not relying on Picasa's API anymore to return custom RSS/XML for the user's search, how can I create xml from another xml based on the user's search queries using only JavaScript and Jquery? Here is the current code: <script type="text/javascript"> var flashvars = { feed : "http%3A%2F%2Frssfeed.ucoz.com%2Frssfeed.xml", backgroundColor : "#FFFFFF", metadataFont : "Arial", wmode : "opaque", iFrameScrolling: "no", numRows : "3", }; var params = { allowFullScreen: "true", allowscriptaccess : "always", wmode: "opaque" }; swfobject.embedSWF("http://apps.cooliris.com/embed/cooliris.swf", "gamewall", "810", "410", "9.0.0", "", flashvars, params); $(document).ready(function() { $("#cooliris input").keydown(function(e) { if(e.keyCode == 13) { $("#cooliris a#searchCooliris").click(); return false; } }); doCoolIrisSearch = function() { cooliris.embed.setFeedContents( '** JAVA STRING OF PARSED RSS/XML based on http%3A%2F%2Frssfeed.ucoz.com%2Frssfeed.xml and USER'S SEARCH INPUT** ' ) }); <form id="searchForm" name="searchForm" class="shockwave"> <input type="text" name="coolIrisSearch" id="coolIrisSearch" value="Search..." class="field text short" onfocus="this.value='';" /> <a id="searchCooliris" href="#" onclick="doCoolIrisSearch();return false;" class="clearLink">Search Cooliris</a> </form> <div id="gamewall"></div> So basically, I want to replace cooliris.embed.setFeedContents's value with a Javastring based on the parsed RSS/XML and user search input. Any code or ideas would be greatly appreciated.

    Read the article

  • SOLR and Natural Language Parsing - Can I use it?

    - by andy
    hey guys, my requirements are pretty similar to this: Requirements http://stackoverflow.com/questions/90580/word-frequency-algorithm-for-natural-language-processing Using Solr While the answer for that question is excellent, I was wondering if I could make use of all the time I spent getting to know SOLR for my NLP. I thought of SOLR because: It's got a bunch of tokenizers and performs a lot of NLP. It's pretty use to use out of the box. It's restful distributed app, so it's easy to hook up I've spent some time with it, so using could save me time. Can I use Solr? Although the above reasons are good, I don't know SOLR THAT well, so I need to know if it would be appropriate for my requirements. Ideal Usage Ideally, I'd like to configure SOLR, and then be able to send SOLR some text, and retrieve the indexed tonkenized content. Context So you guys know, I'm working on a small component of a bigger recommendation engine.

    Read the article

  • How does this RegEx for parsing emails work in PHP?

    - by George Edison
    Okay, I have the following PHP code to extract an email address of the following two forms: Random Stranger <[email protected]> [email protected] Here is the PHP code: // The first example $sender = "Random Stranger <[email protected]>"; $pattern = '/([\w_-]*@[\w-\.]*)|.*<([\w_-]*@[\w-\.]*)>/'; preg_match($pattern,$sender,$matches,PREG_OFFSET_CAPTURE); echo "<pre>"; print_r($matches); echo "</pre><hr>"; // The second example $sender = "[email protected]"; preg_match($pattern,$sender,$matches,PREG_OFFSET_CAPTURE); echo "<pre>"; print_r($matches); echo "</pre>"; My question is... what is in $matches? It seems to be a strange collection of arrays. Which index holds the match from the parenthesis? How can I be sure I'm getting the email address and only the email address? Update: Here is the output: Array ( [0] => Array ( [0] => Random Stranger [1] => 0 ) [1] => Array ( [0] => [1] => -1 ) [2] => Array ( [0] => [email protected] [1] => 5 ) ) Array ( [0] => Array ( [0] => [email protected] [1] => 0 ) [1] => Array ( [0] => [email protected] [1] => 0 ) )

    Read the article

  • Parsing a tweet to extract hashtags into an array in Python.

    - by Scott
    I am having a heck of a time taking the information in a tweet including hashtags, and pulling each hashtag into an array using Python. I am embarrassed to even put what I have been trying thus far. For example, "I love #stackoverflow because #people are very #helpful!" This should pull the 3 hashtags into an array.

    Read the article

  • How might I assume a "default value" when parsing using boost::spirit?

    - by tJener
    Let's say I have a grammar defined to something like: a b c d where c, and d are optional and default to 14 if not given. Can I get it to automatically return the 14 if the value isn't given? The closest I've come is like the following: qi::rule<Iterator, std::vector<int>(), ascii::space_type> some_rule; some_rule %= >> int_ >> int_ >> -int_ >> -int_; // ... some_other_rule = some_rule[&some_callback_for_int_vectors]; which will then get 0 for the optional values that didn't show up (I believe). I then change consecutive 0s at the end into 14. Not only is this horribly wrong, but its also just not elegant. Is there a better way to do this?

    Read the article

  • Ruby - Nokogiri - Parsing XML from memory and putting all same name node values into an array.

    - by r3nrut
    I have an XML I'm trying to parse from memory and get the status of each of my heart beat tests using Nokogiri. Here is the solution I have... xml = <a:HBeat> <a:ElapsedTime>3 ms</a:ElapsedTime> <a:Name>Service 1</a:Name> <a:Status>true</a:Status> </a:HBeat> <a:HBeat> <a:ElapsedTime>4 ms</a:ElapsedTime> <a:Name>Service 2</a:Name> <a:Status>true</a:Status> </a:HBeat> <a:HBeat> I have tried using both css and xpath to pull back the value for each Status and put it into an array. Code is below: doc = Nokogiri::XML.parse(xml) #service_state = doc.css("a:HBeat, a:Status", 'a' => 'http://schemas.datacontract.org/2004/07/OpenAPI.Entity').map {|node| node.children.text} service_state = doc.xpath("//*[@a:Status]", 'a' => 'http://schemas.datacontract.org/2004/07/OpenAPI.Entity').map(&:text) Both will return service_state = []. Any thoughts or recommendations? Also, consider that I have almost identical xml for another test and I used the following snippet of code which does exactly what I wanted but for some reason isn't working with the xml that contains namespaces. service_state = doc.css("HBeat Status").map(&:text) Thanks!

    Read the article

  • Parsing CSV: how can NSScanner recognize empty field (i.e. ,,)?

    - by Fabrizio Prosperi
    I am very new to Xcode and trying - as millions - to parse a CSV file. I have read many contributions and I am managing it but I have a problem when my NSScanner intercepts an empty field: "Field_A, Field_B,, Field_D". I guess it is because it ignores empty space by default, or in this case no space at all. String is: "Personal","2011-01-01","Personal","Cigarettes",,4.60,"Cash","", I tried to debug it using scanLocation: 2011-04-22 15:57:32.414 Spending[42015:a0f] Before while...scan location is:0 2011-04-22 15:57:32.414 Spending[42015:a0f] Account: "Personal" - scan location is:10 2011-04-22 15:57:32.415 Spending[42015:a0f] Date: "2011-01-01" - scan location is:23 2011-04-22 15:57:32.415 Spending[42015:a0f] Category: "Personal" - scan location is:34 2011-04-22 15:57:32.416 Spending[42015:a0f] Subcategory: "Cigarettes" - scan location is:47 2011-04-22 15:57:32.416 Spending[42015:a0f] Income: 4.600000 - scan location is:53 2011-04-22 15:57:32.416 Spending[42015:a0f] Expense: 0.000000 - scan location is:53 2011-04-22 15:57:32.417 Spending[42015:a0f] Payment: "Cash" - scan location is:60 2011-04-22 15:57:32.417 Spending[42015:a0f] Note: "" - scan location is:63 And as you can see after that even expense field gets no value (should be 4.60). Here is the relevant piece of code: NSScanner *scanner = [NSScanner scannerWithString:fileString]; [scanner setCharactersToBeSkipped: [NSCharacterSet characterSetWithCharactersInString:@"\n, "]]; NSString *account, *date, *category, *subcategory, *payment, *note; float income, expense; // Set up data delimiter using comma NSCharacterSet *commaSet; commaSet = [NSCharacterSet characterSetWithCharactersInString:@","]; NSLog (@"Before while...scan location is:%d\n", scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&account]; NSLog(@"Account: %@ - scan location is:%d\n",account, scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&date]; NSLog(@"Date: %@ - scan location is:%d\n",date, scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&category]; NSLog(@"Category: %@ - scan location is:%d\n",category, scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&subcategory]; NSLog(@"Subcategory: %@ - scan location is:%d\n",subcategory, scanner.scanLocation); [scanner scanFloat:&income]; NSLog(@"Income: %f - scan location is:%d\n",income, scanner.scanLocation); [scanner scanFloat:&expense]; NSLog(@"Expense: %f - scan location is:%d\n",expense, scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&payment]; NSLog(@"Payment: %@ - scan location is:%d\n",payment, scanner.scanLocation); [scanner scanUpToCharactersFromSet:commaSet intoString:&note]; NSLog(@"Note: %@\n - scan location is:%d",note, scanner.scanLocation); I tried looking carefully through NSScanner Class Reference, but could not get an idea? Do you have any? Thanks, Fabrizio.

    Read the article

  • Parsing large txt files in ruby taking a lot of time?

    - by hershey92
    below is the code to download a txt file from internet approx 9000 lines and populate the database, I have tried a lot but it takes a lot of time more than 7 minutes. I am using win 7 64 bit and ruby 1.9.3. Is there a way to do it faster ?? require 'open-uri' require 'dbi' dbh = DBI.connect("DBI:Mysql:mfmodel:localhost","root","") #file = open('http://www.amfiindia.com/spages/NAV0.txt') file = File.open('test.txt','r') lines = file.lines 2.times { lines.next } curSubType = '' curType = '' curCompName = '' lines.each do |line| line.strip! if line[-1] == ')' curType,curSubType = line.split('(') curSubType.chop! elsif line[-4..-1] == 'Fund' curCompName = line.split(" Mutual Fund")[0] elsif line == '' next else sCode,isin_div,isin_re,sName,nav,rePrice,salePrice,date = line.split(';') sCode = Integer(sCode) sth = dbh.prepare "call mfmodel.populate(?,?,?,?,?,?,?)" sth.execute curCompName,curSubType,curType,sCode,isin_div,isin_re,sName end end dbh.do "commit" dbh.disconnect file.close 106799;-;-;HDFC ARBITRAGE FUND RETAIL PLAN DIVIDEND OPTION;10.352;10.3;10.352;29-Jun-2012 This is the format of data to be inserted in the table. Now there are 8000 such lines and how can I do an insert by combining all that and call the procedure just once. Also, does mysql support arrays and iteration to do such a thing inside the routine. Please give your suggestions.Thanks.

    Read the article

  • Javascript problem when setting src for img element in FireFox - string parsing error?

    - by Kevin
    I'm having problems with image's on the page. I'm using Javascript to create the elements, and in FireFox it seems the string that I'm using to set the innerHTML is not being parsed correctly. I'll see this when the server page is requested with invalid GET variables. They look like this (from the PHP script's error handler): GET[] = Array ( [shrink] => true [file_id] => \' file_id \' [refresh] => \' now.getTime() \' ) This only happens for about 5% of requests, which is making it difficult to solve. I have been able to reproduce this myself in FireFox, and Firebug will show that the URL it is trying to fetch is: https://www.domain.com/secure/%27%20+%20image_src%20+%20%27 I read somewhere that it might be related to FireFox prefetching content (can't find it googling now), since it seems to only happen on FireFox. Disabling prefetching in about:config does prevent the problem from occurring, but I'm looking for another solution or workaround that doesn't involve end users changing their configurations. Here's the specifics and code: I have an empty table cell on an HTML page. In JQuery's $(document).ready() function for the page, I used JQuery's $.ajax() method to get some data from the server about what should be in that cell. It returns the file_id variable, which for simplicity I just set below. It then sets the empty table cell to have an image with src that points to a page that will serve the image file depending on what file_id is passed. This part of the code was JQuery originally, so I changed it to straight Javascript but that didn't help anything. //get data about image from server //this is actually done through JQuery's $.ajax() but you get the idea var file_id = 12; //create the src for the img //the refresh is to prevent the image from being cached ever, since the page's //javascript will be it changes //during the course of the page's life var now = new Date(); var image_src = 'serve_image.php?shrink=true&file_id=' + file_id + '&refresh=' + now.getTime(); //create document.getElementById('image_cell').innerHTML = '<A target="_blank" href="serve_image.php?file_id=' + file_id + '">' + '<IMG id=image_element src="' + image_src + '" alt="Loading...">' + '</A>';` Any help would be greatly appreciated. Thanks!

    Read the article

  • How would I make this faster? Parsing Word/sorting by heading [on hold]

    - by Doof12
    Currently it takes about 3 minutes to run through a single 53 page word document. Hopefully you all have some advice about speeding up the process. Code: import win32com.client as win32 from glob import glob import io import re from collections import namedtuple from collections import defaultdict import pprint raw_files = glob('*.docx') word = win32.gencache.EnsureDispatch('Word.Application') word.Visible = False oFile = io.open("rawsort.txt", "w+", encoding = "utf-8")#text dump doccat= list() for f in raw_files: word.Documents.Open(f) doc = word.ActiveDocument #whichever document is active at the time doc.ConvertNumbersToText() print doc.Paragraphs.Count for x in xrange(1, doc.Paragraphs.Count+1):#for loop to print through paragraphs oText = doc.Paragraphs(x) if not oText.Range.Tables.Count >0 : results = re.match('(?P<number>(([1-3]*[A-D]*[0-9]*)(.[1-3]*[0-9])+))', oText.Range.Text) stylematch = re.match('Heading \d', oText.Style.NameLocal) if results!= None and oText.Style != None and stylematch != None: doccat.append((oText.Style.NameLocal, oText.Range.Text[:len(results.group('number'))],oText.Range.Text[len(results.group('number')):])) style = oText.Style.NameLocal else: if oText.Range.Font.Bold == True : doccat.append(style, oText) oFile.write(unicode(doccat)) oFile.close() The for Paragraph loop obviously takes the most amount of time. Is there some way of identifying and appending it without going through every Paragraph?

    Read the article

  • Java static source analysis/parsing (possibly with antlr), what is a good tool to do this?

    - by Berlin Brown
    I need to perform static source analysis on Java code. Ideally, I want the system to work out of the box without much modification from me. For example, I have used Antlr in the past, but I spent a lot of time building grammar files and still didn't get what I wanted. I want to be able to parse a java file and have return the character position of say: Character position start and end of a Java block comment Character position start and end of a Java class file Character position start and end of a Java method declaration, signature, and implementation. It looks like Antlr will do that, but I have yet to finish a grammar that actually gives me the positions of the code I need. Does anyone have that complete Antlr grammar and Java code to give the character positions of the parts in the Java source.

    Read the article

  • OpenType Font Parsing for Pleasure and Profit (anyone understand these damn tables?)

    - by mustISignUp
    So, this is mainly for fun, I'm poking around and trying to find my way inside a few fonts and i have a few questions i'd reeally appreciate some help on if anyone has done this kind of stuff. cmap table The fonts i am testing with contain several cmap subtables of different formats. I can read them, but i don't understand which i should be using. ie. what is the strategy for choosing the most appropriate subtable? Does this even make sense? glyf table This is really making my head hurt. I'm going by what is on here. Looking at the second table on that page.. I've got 'n' endPtsOfContours, 'n' instructions and 'n' flags but it is not clear to me if i have the same number of flags as contours (i know how many contours i have). Then, to make matters worse..(fun!) i have an array of xCoords and an array of yCoords. These arrays seem to be of indeterminate length and may contain data of either BYTE or SHORT but we are not going to tell you which.. Thanks to anyone willing to shed some light.

    Read the article

  • Parsing timestamps - do it in MySQL or in PHP?

    - by Andrew Heath
    Let's say you've got a table with a timestamp column, and you want to parse that column into two arrays - $date and $time. Do you, personally: a) query like this DATE(timestamp), TIME(timestamp) , or perhaps even going as far as HOUR(timestamp), MINUTE(timestamp b) grab the timestamp column and parse it out as needed with a loop in PHP I feel like (a) is easier... but I know that I don't know anything. And it feels a little naughty to make my query hit the same column 2 or 3 times for output... Is there a best-practice for this?

    Read the article

  • Is it possible to exclude some elements from parsing when using regular expression and .replace()?

    - by Fletus Mefitis
    <script language="javascript"> $("div.post-content , .parsedsig").each(function(){ if($(this).html().indexOf("[/tabulaScriptum]") != -1) { pattern = /\[tabulaScriptum=(.*?)\]([^\[]*)\[\/tabulaScriptum\]/gi $(this).html($(this).html().replace(pattern, "<div class='tabulaScriptum'><div class='tabulaNomen'>$1</div><div class='tabulaImpleo'>$2</div></div>")) } }); </script> This script is working perfectly, except for one thing... I need not to replace [tabulaScriptum=][/tabulaScriptum] in certain elements. For example, I don't want to replace those "tags" in element that has class .code-box. Is it possible? Clarification: element .code-box is located within .post-content. Clarification #2: this script creates simple division spoiler. .tabulaScriptum is spoier's body, .tabulaNomen is spoiler's name and button which, in turn, reveals(or hides) .tabulaImpleo on click. Reveal\hide script is located in some other place, and I didn't post it here since it doesn't really matter. Clarification #3: http://jsfiddle.net/PRtsw/1/ fiddle.

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >