Search Results

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

Page 49/128 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • processing json objects in jsp

    - by user98534
    i have a JSON object sent from the browser to the jsp page. how do i receive that object and process it in jsp. do i need any specific parsers? i have used the following piece of code. but it wouldnt work. essentially i should read the contents of the object and print them in the jsp. <%@page language="java" import="jso.JSONObject"%> <% JSONObject inp=request.getParameter("param1"); %> <% for(int i=0;i<inp.size();i++) {%> <%=inp.getString(i)%> <% } %>

    Read the article

  • Parser that accepts Scala Identifiers?

    - by Mirko Stocker
    I was wondering whether the standard Scala parser combinators contain a parser that accepts the same identifiers that the Scala language itself also accepts (as specified in the Scala Language Specification, Section 1.1). The StdTokenParsers trait has an ident parser, but it rejects identifiers like empty_?. (If there is indeed no such parser, I could also just instantiate the Scala parser itself, but that wouldn't be as lightweight anymore.)

    Read the article

  • Android Alert Dialog Extract User Choice Radio Button?

    - by kel196
    Apologies for any coding ignorance, I am a beginner and am still learning! I am creating a quiz app which reads questions off a SQL database and plots them as points on a google map. As the user clicks each point, an alert dialog appears with radio buttons to answer some question. My radiobuttons are in CustomItemizedOverlay file and when I click submit, I want to be able to send the user choice back to the database, save it and return to the user if their answer is correct. My question is this, how do I pass the user choice out once the submit button has been clicked? I tried making a global variable to read what was selected to no avail. Any suggestions would be appreciated! If I need to post any other code, please ask and I will do so ASAP! package uk.ac.ucl.cege.cegeg077.uceskkw; import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.widget.Toast; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; public class CustomItemizedOverlay2 extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>(); private Context context; public CustomItemizedOverlay2(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); } public CustomItemizedOverlay2(Drawable defaultMarker, Context context) { this(defaultMarker); this.context = context; } @Override protected OverlayItem createItem(int i) { return mapOverlays.get(i); } @Override public int size() { return mapOverlays.size(); } @Override protected boolean onTap(int index) { OverlayItem item = mapOverlays.get(index); // gets the snippet from ParseKMLAndDisplayOnMap and splits it back into // a string. final CharSequence allanswers[] = item.getSnippet().split("::"); AlertDialog.Builder dialog = new AlertDialog.Builder(context); dialog.setIcon(R.drawable.easterbunnyegg); dialog.setTitle(item.getTitle()); dialog.setSingleChoiceItems(allanswers, -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(context, "You have selected " + allanswers[whichButton], Toast.LENGTH_SHORT).show(); } }); dialog.setPositiveButton(R.string.button_submit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); // int selectedPosition = ((AlertDialog) // dialog).getListView().getCheckedItemPosition(); Toast.makeText(context, "hi!", Toast.LENGTH_SHORT) .show(); } }); dialog.setNegativeButton(R.string.button_close, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); // on cancel button action } }); AlertDialog question = dialog.create(); question.show(); return true; } public void addOverlay(OverlayItem overlay) { mapOverlays.add(overlay); this.populate(); } }

    Read the article

  • How can I parse through a texutre in DirectX? (IDirect3DTexture9*)

    - by meds
    I've been trying to figure out how to parse textures in directx for two reasons: to write my own texture format and to manipulate data in existing IDirect3DTexture9 type textures. I've been looking at the IDirect3DTexture9::LockRect() function but I'm unsure how it works, are the void* pBits I get out of it in D3DLOCKED_RECT the data in the texture? Does that mean I can read it in by converting it to D3DXCOLOR or something? Really not sure where to go, any help would be appreciated!

    Read the article

  • Little Regular Expression (against HTML) help

    - by Marcos Placona
    Hi, I have the following HTML <p>Some text <a title="link" href="http://link.com/" target="_blank">my link</a> more text <a title="link" href="http://link.com/" target="_blank">more link</a>.</p> <p>Another paragraph.</p> <p>[code:cf]</p> <p>&lt;cfset ArrFruits = ["Orange", "Apple", "Peach", "Blueberry", </p> <p>"Blackberry", "Strawberry", "Grape", "Mango", </p> <p>"Clementine", "Cherry", "Plum", "Guava", </p> <p>"Cranberry"]&gt;</p> <p>[/code]</p> <p>Another line</p> <p><img src="http://image.jpg" alt="Array" /> </p> <p>More text</p> <p>[code:cf]</p> <p>&lt;table border="1"&gt;</p> <p> &lt;cfoutput&gt;</p> <p> &lt;cfloop array="#GroupsOf(ArrFruits, 5)#" index="arrFruitsIX"&gt;</p> <p>  &lt;tr&gt;</p> <p> &lt;cfloop array="#arrFruitsIX#" index="arrFruit"&gt;</p> <p>     &lt;td&gt;#arrFruit#&lt;/td&gt;</p> <p> &lt;/cfloop&gt;</p> <p>  &lt;/tr&gt;</p> <p> &lt;/cfloop&gt;</p> <p> &lt;/cfoutput&gt;</p> <p>&lt;/table&gt;</p> <p>[/code]</p> <p>With an output that looks like:</p> <p><img src="another_image.jpg" alt="" width="342" height="85" /></p> What I'm trying to do, is write a regular expression that will remove all the or , and whenever it finds a , it will replace it with a line-break. So far, my pattern looks like this: /\<p\>(.*?)(<\/p>)/g And I'm replacing the matches with: $1\n It all looks good, but it's also replacing the contents inside the [code][/code] tags, which in this case should not replace the tags at all, so as a result, i would lkike to get rid of the tags, when the content isn't inside the [code] tags. I can't ever get negation right, I know it will be something along the lines of \<p\>^\[code*\](.*?)(<\/p>) But obviously this doesn't work :-) Could anyone please lend me a hand with this regex? BTW, I know I shouldn't be using regular expressions to parse HTML at all. I'm fully aware of that, but still, for this specific case, I'd like to use regex. Thanks in advance

    Read the article

  • Parse Formulae in .NET

    - by Cool
    I am trying to parse formula in C# language like "5*3 + 2" "(3*4 - 2)/5" Is it possible to do in C# or scripts like VBScript, JavaScript (which will be called in c# program).

    Read the article

  • How to use JQuery to truncate the contents of option tags?

    - by George
    Hello! Please take a look here: http://www.binarymark.com/Products/FLVDownloader/order.aspx What I am trying to do is to get rid of the prices inside the option tag. On that page you can see a drop-down box under Order Information, Product. I want to remove the prices from all the options that contain them in that box, so get rid of " - $75.98" for example. I am not used to JQuery, but I realize it would be possible - just not sure how to do it, so your help would be greatly appreciated. Thanks. George

    Read the article

  • Simple Iphone XML Example

    - by dub
    Hi, I a bit overwhelmed with all of the sample code I've seen on the apple dev site. I'm looking for a simple example to show me how to load an xml file from a server into iphone. I would like to read url's from this xml file and load an image.

    Read the article

  • SQL decimal conversion error

    - by jakesankey
    Hey, my app parses numerous txt files in a directory that are almost all formatted identically, then inserts the values into columns of my sql db. However, there are a few files that the app has come across where a value is 'blank' instead of '0.0', so the application fails stating that it cannot convert that value to numeric. Is there a way I could change the following code to say what says AND also add 'IF value is blank, then import 0.0 instead? foreach (SqlParameter parameter in insertCommand.Parameters) { parameter.Value = null; } string[] values = line.Split(new[] { ',' }); for (int i = 0; i < values.Length - 1; i++) { // if (i = "" || i = null) continue; SqlParameter param = insertCommand.Parameters[i]; if (param.DbType == DbType.Decimal) { decimal value; param.Value = decimal.TryParse(values[i], out value) ? value : 0; } else { param.Value = values[i]; } }

    Read the article

  • PyParsing: Is this correct use of setParseAction()?

    - by Rosarch
    I have strings like this: "MSE 2110, 3030, 4102" I would like to output: [("MSE", 2110), ("MSE", 3030), ("MSE", 4102)] This is my way of going about it, although I haven't quite gotten it yet: def makeCourseList(str, location, tokens): print "before: %s" % tokens for index, course_number in enumerate(tokens[1:]): tokens[index + 1] = (tokens[0][0], course_number) print "after: %s" % tokens course = Group(DEPT_CODE + COURSE_NUMBER) # .setResultsName("Course") course_data = (course + ZeroOrMore(Suppress(',') + COURSE_NUMBER)).setParseAction(makeCourseList) This outputs: >>> course.parseString("CS 2110") ([(['CS', 2110], {})], {}) >>> course_data.parseString("CS 2110, 4301, 2123, 1110") before: [['CS', 2110], 4301, 2123, 1110] after: [['CS', 2110], ('CS', 4301), ('CS', 2123), ('CS', 1110)] ([(['CS', 2110], {}), ('CS', 4301), ('CS', 2123), ('CS', 1110)], {}) Is this the right way to do it, or am I totally off? Also, the output of isn't quite correct - I want course_data to emit a list of course symbols that are in the same format as each other. Right now, the first course is different from the others. (It has a {}, whereas the others don't.)

    Read the article

  • In Ruby Compare 2 lines in a log file which BOTH contain the SAME "WORD" but ONLY print out the line

    - by kamal
    here are sample lines Apr 9 11:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred some other log lines .. .... Apr 9 12:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred now the LATEST line would have to be one with the latest Date String, and THAT is the one that needs to be printed, plus the NEXT time the parser runs on the log file, somehow the previous LATEST line has to be compared with the Existing latest one, and it CAN e the case, that NOTHING Changed and the OLD line is STILL the latest one, OR there is a NEW line, but ONLY the NEW log line should be printed and NOT if there is NO NEW log Entry.

    Read the article

  • Boost info parser

    - by Ockonal
    Hello, I'm going to use boost INFO parser There is examples of file structure but not of using. Could you help me with reading key/value from boost info file?

    Read the article

  • Extracting function declarations from a PHP file

    - by byronh
    I'm looking to create an on-site API reference for my framework and application. Basically, say I have a class file model.class.php: class Model extends Object { ... code here ... // Separates results into pages. // Returns Paginator object. final public function paginate($perpage = 10) { ... more code here ... } } and I want to be able to generate a reference that my developers can refer to quickly in order to know which functions are available to be called. They only need to see the comments directly above each function and the declaration line. Something like this (similar to a C++ header file): // Separates results into pages. // Returns Paginator object. final public function paginate($perpage = 10); I've done some research and this answer looked pretty good (using Reflection classes), however, I'm not sure how I can keep the comments in. Any ideas? EDIT: Sorry, but I want to keep the current comment formatting. Myself and the people who are working on the code hate the verbosity associated with PHPDocumentor. Not to mention a comment-rewrite of the entire project would take years, so I want to preserve just the // comments in plaintext.

    Read the article

  • What is the easiest way to loop through a folder of files in C#?

    - by badpanda
    I am new to C# and am trying to write a program that navigates the local file system using a config file containing relevant filepaths. My question is this: What are the best practices to use when performing file I/O (this will be from the desktop app to a server and back) and file system navigation in C#? I know how to google, and I have found several solutions, but I would like to know which of the various functions is most robust and flexible. As well, if anyone has any tips regarding exception handling for C# file I/O that would also be very helpful. Thanks!!! badPanda

    Read the article

  • Split string into smaller part with constrain [PHP RegEx HTML]

    - by Sadi
    Hello, I need to split long string into a array with following constrains: Each part will have a limited number of character (e.g. not more than 8000 character) Each part can contain multiple sentences (delimited by . [full stop]) but never a partial sentences. Except if the last part of the string (as last part may not have any full stop. The string may contain HTML tags. But the tag can not be divided as ( to ). That means HTML tag should be intact. But starting tag and ending tag can be stay on different segment/chunk. I think regular expression with preg_split can do it. Would please help me with the proper RegEx. Thank you Sadi

    Read the article

  • parse youtube video id using preg_match

    - by Webbo
    Hi, I am attempting to parse the video ID of a youtube URL using preg_match. I found a regular expression on this site that appears to work; (?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+ As shown in this pic; http://i.imgur.com/SQJW2.jpg My PHP is as follows, but it doesn't work (gives Unknown modifier '[' error)... <? $subject = "http://www.youtube.com/watch?v=z_AbfPXTKms&NR=1"; preg_match("(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+", $subject, $matches); print "<pre>"; print_r($matches); print "</pre>"; ?> Cheers

    Read the article

  • Removing HTML entities while preserving line breaks with JSoup

    - by shrodes
    I have been using JSoup to parse lyrics and it has been great until now, but have run into a problem. I can use Node.html() to return the full HTML of the desired node, which retains line breaks as such: Gl&oacute;andi augu, silfurn&aacute;tt <br />Bl&oacute;&eth; alv&ouml;ru, starir &aacute; <br />&Oacute;&eth;ur hundur er &iacute; v&iacute;gam&oacute;&eth;, &iacute; maga... m&eacute;r <br /> <br />Kolni&eth;ur gref, kvik sem dreg h&eacute;r <br />Kolni&eth;ur svart, hvergi bjart n&eacute; But has the unfortunate side-effect, as you can see, of retaining HTML entities and tags. However, if I use Node.text(), I can get a better looking result, free of tags and entities: Glóandi augu, silfurnátt Blóð alvöru, starir á Óður hundur er í vígamóð, í maga... mér Kolniður gref, kvik sem dreg hér Kolniður svart, Which has another unfortunate side-effect of removing the line breaks and compressing into a single line. Simply replacing <br /> from the node before calling Node.text() yields the same result, and it seems that that method is compressing the text onto a single line in the method itself, ignoring newlines. Is it possible to have the best of both worlds, and have tags and entities replaced correctly which preserving the line breaks, or is there another method or way of decoding entities and removing tags without having to replace them manually?

    Read the article

  • C# equivalent of NaN or IsNumeric

    - by johnc
    This seems like a fairly simple question, and I'm surprised not to have required it before. What is the most efficient way of testing a string input is a numeric (or conversely Not A Number). I guess I can do a Double.Parse or a regex (see below) public static bool IsNumeric(this string value) { return Regex.IsMatch(value, "^\\d+$"); } but I was wondering if there was a implemented way to do it, such as javascript's NaN() or IsNumeric() (was that VB, I can't remember).

    Read the article

  • Problem Fetching JSON Result with jQuery in Firefox and Chrome (IE8 Works)

    - by senfo
    I'm attempting to parse JSON using jQuery and I'm running into issues. Using the code below, the data keeps coming back null: <!DOCTYPE html> <html> <head> <title>JSON Test</title> </head> <body> <div id="msg"></div> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $.ajax({ url: 'http://datawarehouse.hrsa.gov/ReleaseTest/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10&filter=8357&format=JSON', type: 'GET', dataType: 'json', success: function(data) { $('#msg').html(data[0].title); // Always null in Firefox/Chrome. Works in IE8. }, error: function(data) { alert(data); } }); </script> </body> </html> The JSON results look like the following: {"title":"HEALTHPOINT TYEE CAMPUS","link":"http://www.healthpointchc.org","id":"tag:datawarehouse.hrsa.gov,2010-04-29:/8357","org":"HEALTHPOINT TYEE CAMPUS","address":{"street-address":"4424 S. 188TH St.","locality":"Seatac","region":"Washington","postal-code":"98188-5028"},"tel":"206-444-7746","category":"Service Delivery Site","location":"47.4344818181818 -122.277672727273","update":"2010-04-28T00:00:00-05:00"} If I replace my URL with the Flickr API URL (http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?), I get back a valid JSON result that I am able to make use of. I have successfully validated my JSON at JSONLint, so I've run out of ideas as to what I might be doing wrong. Any thoughts? Update: I had the client switch the content type to application/json. Unfortunately, I'm still experiencing the exact same problem. I also updated my HTML and included the live URL I've been working with. Update 2: I just gave this a try in IE8 and it works fine. For some reason, it doesn't work in either Firefox 3.6.3 or Chrome 4.1.249.1064 (45376). I did notice a mistake with the data being returned (the developer is returning a collection of data, even for queries that will always return a single record), but it still baffles me why it doesn't work in other browsers. It might be important to note that I am working from an HTML file on my local file system. I thought it might be a XSS issue, but that doesn't explain why Flickr works.

    Read the article

  • Wrap words in tags, keep markup

    - by spacevillain
    For example I have a string with markup (from html node): hello, this is dog "h<em>e<strong>llo, thi</strong>s i</em><strong>s d</strong>og" What is the most correct way to find some words in it (let's say "hello" and "dog"), wrap them in a span (make a highlight) and save all the markup? Desired output is something like this (notice properly closed tags) <span class="highlight">h<em>e<strong>llo</strong></em></span><strong>,</strong> <em><strong>thi</strong>s<em> i</em><strong>s <span class="highlight"><strong>d</strong>og</span> Looks the same as it should: hello, this is dog

    Read the article

  • YQL Open Data Table for Wikipedia

    - by Rob Young
    Has anyone written a YQL open data table for accessing Wikipedia? I've had a hunt around the internet and found mention of people using YQL for extracting various bits of information from Wikipedia pages such as microformats, links or content but I haven't been able to find an open data table that ties it all together.

    Read the article

  • PDFParsing & extracting the images only in iPhone application.

    - by sagar
    Hello - Every one. ** : My Query : ** I want to extract only images from entire pdf document. ( Using Objective C - for iPhone Application ) : My Efforts : I have gone through this link which has details regarding different operators of PDF Document. ( http://mail-archives.apache.org/mod_mbox/pdfbox-commits/200912.mbox/%[email protected]%3E ) I also studied this document - ( http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf_scan/dq_pdf_scan.html#//apple_ref/doc/uid/TP30001066-CH220-TPXREF101 ) I also have gone through entire document of PDFReference.pdf ( From original Adobe Site ) PDFReference.pdf (Adobe Document - says that - for image there are following operators ) q Q BI EI I have placed following table get the image myTable = CGPDFOperatorTableCreate(); CGPDFOperatorTableSetCallback(myTable, "q", arrayCallback2); CGPDFOperatorTableSetCallback(myTable, "TJ", arrayCallback); CGPDFOperatorTableSetCallback(myTable, "Tj", stringCallback); I have following arrayCallback2 method for getting image void arrayCallback2(CGPDFScannerRef inScanner, void *userInfo) { // how to extract image from this code // means I have tried too many different ways. following is incorrect way & not giving image // CGPDFStreamRef stream; // represents a sequence of bytes // if (CGPDFDictionaryGetStream (d, "BI", &stream)){ // CGPDFDataFormat t=CGPDFDataFormatJPEG2000; // CFDataRef data = CGPDFStreamCopyData (stream, &t); // } } above arrayCallback2 method is called for operator "q", But I don't know How to extract the image from it. In short. What should be the solution for extracting the images from the pdf documents? Thanks in advance for your kind help. Sagar kothari.

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >