Search Results

Search found 4962 results on 199 pages for 'parse'.

Page 5/199 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Python response parse [migrated]

    - by Pavel Shevelyov
    When I'm sending some data on host: r = urllib2.Request(url, data = data, headers = headers) page = urllib2.urlopen(r) print page.read() I have something like this: [{"command":"settings","settings":{"basePath":"\/","ajaxPageState":{"theme":"spsr","theme_token":"kRHUhchUVpxAMYL8Y8IoyYIcX0cPrUstziAi8gSmMYk","css":[]},"ajax":{"edit-submit":{"callback":"spsr_calculator_form_ajax","wrapper":"calculator_form","method":"replaceWith","event":"mousedown","keypress":true,"url":"\/ru\/system\/ajax","submit":{"_triggering_element_name":"submit"}}}},"merge":true},{"command":"insert","method":null,"selector":null,"data":"\u003cdiv id=\"calculator_form\"\u003e\u003cform action=\"\/ru\/service\/calculator\" method=\"post\" id=\"spsr-calculator-form\" accept-charset=\"UTF-8\"\u003e\u003cdiv\u003e\u003cinput id=\"edit-from-ship-region-id\" type=\"hidden\" name=\"from_ship_region_id\" value=\"\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_build_id\" value=\"form-0RK_WFli4b2kUDTxpoqsGPp14B_0yf6Fz9x7UK-T3w8\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_id\" value=\"spsr_calculator_form\" \/\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"bg_p\"\u003e \n\u0421\u0435\u0439\u0447\u0430\u0441 \u0412\u044b... bla bla bla but I want have something, like this: <html><h1>bla bla bla</h1></html> How can I do it?

    Read the article

  • Parse git log by modified files

    - by MrUser
    I have been told to make git messages for each modified file all one line so I can use grep to find all changes to that file. For instance: $git commit -a modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc...... $git log | grep path/to/file.cpp/.h modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc...... modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc...... modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc...... That's great, but then the actual line is harder to read because it either runs off the screen or wraps and wraps and wraps. If I want to make messages like this: $git commit -a modified: path/to/file.cpp/.h 1) change1 2) change2 etc...... is there a good way to then use grep or cut or some other tool to get a readout like $git log | grep path/to/file.cpp/.h modified: path/to/file.cpp/.h 1) change1 2) change2 etc...... modified: path/to/file.cpp/.h 1) change1 2) change2 etc...... modified: path/to/file.cpp/.h 1) change1 2) change2 etc......

    Read the article

  • Using linq to parse file [closed]

    - by Emaan Abdul majeed
    i am working parsing textfile using LINQ but got struc on it,its going outof range exception string[] lines = File.ReadAllLines(input); var t1 = lines .Where(l => !l.StartsWith("#")) .Select(l => l.Split(' ')) .Select(items => String.Format("{0}{1}{2}", items[1].PadRight(32), //items[1].PadRight(16) items[2].PadRight(32), items[3].PadRight(32))); var t2 = t1 .Select(l => l.ToUpper()); foreach (var t in t2) Console.WriteLine(t); and file is about 200 to 500 lines and i want to extract specific information so i need to split that information to different structure so how to do it this..

    Read the article

  • How to parse json string to dataset in C#

    - by Samir R. Bhogayta
    // Serialization of DataSet to json string StringWriter sw = new StringWriter(); versionUpGetData.WriteXml(sw, XmlWriteMode.WriteSchema); XmlDocument xd = new XmlDocument(); xd.LoadXml(sw.ToString()); String jsonText = JsonConvert.SerializeXmlNode(xd); File.WriteAllText(“d:/datasetJson.txt”,jsonText); //Deserialization of Json String to DataSet XmlDocument xd1 = new XmlDocument(); xd1 = (XmlDocument)JsonConvert.DeserializeXmlNode(jsonText); DataSet jsonDataSet = new DataSet(); jsonDataSet.ReadXml(new XmlNodeReader(xd1));

    Read the article

  • IIS to parse php in a .dll files

    - by Agony
    The .dll files ain't the dynamic link library. That's what the client side software calls for (cannot change). Its essentially a php script that should run and return specific values. However currently it simply downloads it and that results in a failure. That's what it results in on a Apache server: [Update] NewVersion=1 UpdateFileNumber=1 UpdateFile1=update1/LPServerInfo.dat ServerNumber=1 Server1=http://88.159.116.217/ here it is on IIS: 198.24.133.74:8080/update.dll?0 renaming it to php works fine for testing - it runs and returns values. I edited the MIME and set .dll to application/x-httpd-php but that doesn't seem to work in IIS. Any solutions?

    Read the article

  • How to parse multiple dates from a block of text in Python (or another language)

    - by mlissner
    I have a string that has several date values in it, and I want to parse them all out. The string is natural language, so the best thing I've found so far is dateutil. Unfortunately, if a string has multiple date values in it, dateutil throws an error: >>> s = "I like peas on 2011-04-23, and I also like them on easter and my birthday, the 29th of July, 1928" >>> parse(s, fuzzy=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/dateutil/parser.py", line 697, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File "/usr/lib/pymodules/python2.7/dateutil/parser.py", line 303, in parse raise ValueError, "unknown string format" ValueError: unknown string format Any thoughts on how to parse all dates from a long string? Ideally, a list would be created, but I can handle that myself if I need to. I'm using Python, but at this point, other languages are probably OK, if they get the job done. PS - I guess I could recursively split the input file in the middle and try, try again until it works, but it's a hell of a hack.

    Read the article

  • Javascript - use to load xml data from URL

    - by spenf
    I have this url with some xml data in it: http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml And I would like to load this xml data into my javascript script so I can parse it. I am using parse.com Javascript SDK, in there cloud code. Here is the code I have tried: Parse.Cloud.define("next", function(request, response) { response.success("Hello world!"); $.ajax({ url: 'http://64.182.231.116/~spencerf/union_college/Upperclass_Sample_Menu.xml', // name of file you want to parse dataType: "xml", // type of file you are trying to read success: parse, // name of the function to call upon success error: function(){alert("Error: Something went wrong");} }); }); But when I run this I get an error: $ is not defined at main.js:

    Read the article

  • JSON.parse string with quotes

    - by mjsilva
    Hi, I've this: JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\" SATA2 7200rpm"}}'); http://www.jsonlint.com/ says it's perfectly valid json. But on execution I have a JSON.parse error. But, if I change my code to: JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\\" SATA2 7200rpm"}}'); (note the double backslash) It works, but now jsonlint gives me invalid json :/ Can someone help to understand this behavior?

    Read the article

  • javascript Date.parse

    - by user121196
    Case One: new Date(Date.parse("Jul 8, 2005")); Output: Fri Jul 08 2005 00:00:00 GMT-0700 (PST) Case Two: new Date(Date.parse("2005-07-08")); Output: Thu Jul 07 2005 17:00:00 GMT-0700 (PST) Why is the second parse incorrect?

    Read the article

  • BlackBerry : How to Parse XML file ?

    - by yakub_moriss
    Hi, All I want to know how to parse xml data in blackberry. and also want to know diferent methods available. as i read somewhere that JSON is good method to parse xml data. is there any tutorials to parse xml data using JSON. Simple parsing method tutorial is also acceptable... plz help me out... Thanks in advance...

    Read the article

  • lxml unicode entity parse problems

    - by Jon Hadley
    I'm using lxml as follows to parse an exported XML file from another system: xmldoc = open(filename) etree.parse(xmldoc) But im getting: lxml.etree.XMLSyntaxError: Entity 'eacute' not defined, line 4495, column 46 Obviously it's having problems with unicode entity names - but how would i get round this? Via open() or parse()?

    Read the article

  • Graceful Degradation with JSON.Parse

    - by Steve
    If a browser doesn't support JSON.parse, would it make sense to include json.js and call parseJSON in lieu? So the code would looks something like: var z; if (JSON.parse) z = JSON.parse(yada); else z = JSON.parseJSON(yada);

    Read the article

  • How to resolve parse error in Splint

    - by Thi
    Splint is not continuing it's checking after finding parse errors. I've tried with +trytorecover option also but no change. Please let me know on how to use +trytorecover to make Splint attempt to continue after a parse error. Here is what I'm receiving, 161: splint +trytorecover spy.c Splint 3.1.1 --- 19 Jul 2006 spy.c:41:12: Parse Error: Non-function declaration: byte_4 : int. Attempting to continue. spy.c:41:12: Cannot recover from parse error. *** Cannot continue.

    Read the article

  • How to Parse through nsXml Parser.

    - by chsab420
    Hey All, i am very new to iphone Development and i am asked to use nsxml parser to parse xml from a google api. i have parsed another url which has xml but i am not able to parse google's because it is using id's to store data rather than inside tag. i.e. Can somebody help me that how can i parse the attribute inside the tag. Thanks & Regards

    Read the article

  • Parse java console output with awk

    - by Bob Rivers
    Hi, I'm trying to use awk to parse an output generated by a java application, but it isn't working. It seems that the command after the pipe isn't able to get/see the data throwed by the java app. I'm executing the following command (with the return generated by the command): [root@localhost]# java -jar jmxclient.jar usr:pass host:port java.lang:type=Threading ThreadCount 06/11/2010 15:46:37 -0300 org.archive.jmx.Client ThreadCount: 103 What I need it's only the last part of the string. So I'm tryng to use awk (with pipe at the end of the line |awk -F ':' '{print $4}': [root@localhost]# java -jar jmxclient.jar usr:pass host:port java.lang:type=Threading ThreadCount|awk -F ':' '{print $4}' But the output isn't being parsed. It throws the entire string: 06/11/2010 15:46:37 -0300 org.archive.jmx.Client ThreadCount: 103 I also tryed to use |cut -f4 -d":" with the same result: the string isn't parsed. So my question is, how do I parse the output in order to get just the number at the end of the string? TIA, Bob

    Read the article

  • ruby parseexecel gem - array not implemented

    - by josh
    I am trying to work with two worksheets at the same time. So I have code require 'parseexcel' #Open the excel file passed in from the commandline workbook = Spreadsheet::ParseExcel.parse(ARGV[0]) workbook2 = Spreadsheet::ParseExcel.parse(ARGV[1]) #Get the first worksheet worksheet = workbook.worksheet(0) worksheet2 = workbook2.worksheet(0) However, when I run this code I get an error: array is not implemented This error goes away when I comment out line: workbook2 = Spreadsheet::ParseExcel.parse(ARGV[1]) Why is this happeneing? Way I am running script is: ruby -rubygems traverse.rb excel.xls so.xls

    Read the article

  • Nokogiri Not Parsing File

    - by Jesse J
    I'm using Nokogiri to parse pepXML files from different peptide search engines. I have two pepXML files, both of which appear, inasmuch as I can tell, to be of correct format, and puts Nokogiri::XML(IO.read(file)) will output the whole XML file for both files. The problem is, doc.xpath("any valid xpath") will parse the tag from one of the files, but not the other. No errors are given, so I have no idea why it won't parse. Anyone know of any reasons why Nokogiri wouldn't parse something out?

    Read the article

  • Parse filename, insert to SQL

    - by jakesankey
    Thanks to Code Poet, I am now working off of this code to parse all .txt files in a directory and store them in a database. I need a bit more help though... The file names are R303717COMP_148A2075_20100520.txt (the middle section is unique per file). I would like to add something to code so that it can parse out the R303717COMP and put that in the left column of the database such as: (this is not the only R number we have) R303717COMP data data data R303717COMP data data data R303717COMP data data data etc Lastly, I would like to have it store each full file name into another table that gets checked so that it doesn't get processed twice.. Any Help is appreciated. using System; using System.Data; using System.Data.SQLite; using System.IO; namespace CSVImport { internal class Program { private static void Main(string[] args) { using (SQLiteConnection con = new SQLiteConnection("data source=data.db3")) { if (!File.Exists("data.db3")) { con.Open(); using (SQLiteCommand cmd = con.CreateCommand()) { cmd.CommandText = @" CREATE TABLE [Import] ( [RowId] integer PRIMARY KEY AUTOINCREMENT NOT NULL, [FeatType] varchar, [FeatName] varchar, [Value] varchar, [Actual] decimal, [Nominal] decimal, [Dev] decimal, [TolMin] decimal, [TolPlus] decimal, [OutOfTol] decimal, [Comment] nvarchar);"; cmd.ExecuteNonQuery(); } con.Close(); } con.Open(); using (SQLiteCommand insertCommand = con.CreateCommand()) { insertCommand.CommandText = @" INSERT INTO Import (FeatType, FeatName, Value, Actual, Nominal, Dev, TolMin, TolPlus, OutOfTol, Comment) VALUES (@FeatType, @FeatName, @Value, @Actual, @Nominal, @Dev, @TolMin, @TolPlus, @OutOfTol, @Comment);"; insertCommand.Parameters.Add(new SQLiteParameter("@FeatType", DbType.String)); insertCommand.Parameters.Add(new SQLiteParameter("@FeatName", DbType.String)); insertCommand.Parameters.Add(new SQLiteParameter("@Value", DbType.String)); insertCommand.Parameters.Add(new SQLiteParameter("@Actual", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@Nominal", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@Dev", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@TolMin", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@TolPlus", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@OutOfTol", DbType.Decimal)); insertCommand.Parameters.Add(new SQLiteParameter("@Comment", DbType.String)); string[] files = Directory.GetFiles(Environment.CurrentDirectory, "TextFile*.*"); foreach (string file in files) { string[] lines = File.ReadAllLines(file); bool parse = false; foreach (string tmpLine in lines) { string line = tmpLine.Trim(); if (!parse && line.StartsWith("Feat. Type,")) { parse = true; continue; } if (!parse || string.IsNullOrEmpty(line)) { continue; } foreach (SQLiteParameter parameter in insertCommand.Parameters) { parameter.Value = null; } string[] values = line.Split(new[] {','}); for (int i = 0; i < values.Length - 1; i++) { SQLiteParameter 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]; } } insertCommand.ExecuteNonQuery(); } } } con.Close(); } } } }

    Read the article

  • Parse MIME messages

    - by Abhimanyu
    Hi, For my new project which has email module.i need to show all the email information on web.when i m making a call to server i m getting the base64 encoded mime data. after applying base64 decoding technique i m getting the mime data as follows: /*****************Mime data start *******************************/ From [email protected] Tue Jun 23 12:01:02 2009 Date: Tue, 23 Jun 2009 12:01:02 +0530 From: Prashant R Naik <[email protected]> To: [email protected] Subject: This is a test mail Message-ID: <[email protected]> Reply-To: Prashant R Naik <[email protected]> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Status: RO Content-Length: 1912 Lines: 52 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Test mail. Initiated by prashant Regards, -- Prashant R Naik Principal Technologist | Symbian & Web2.0 Geodesic Limited | www.geodesic.com Tel: +91-80-66551000 --ReaqsoxgOBHFXBhH Content-Type: image/gif Content-Disposition: attachment; filename="trash.gif" Content-Transfer-Encoding: base64 R0lGODlhEAAQANUoADJ8wTqU2DmR1TqV2DN9wTSBxTWFyTaGyTJ9wTWGyTaKzjmS1TOAxTuV 2DaFyTN8wDiN0jiO0jSAxTeKzjqS1DN8wTqR1TWFyjB4vTOBxTmO0TmS1DaKzTeJzTqV1zSA xDJ8wDqS1TeKzTF4vDF4vTiO0f///zuX2gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACgALAAA AAAQABAAAAaDQNRpSCwWhcakcsk8mZ5Qpik5pUKvT2W1uDVWp+BiYNAImAZmz/lcDoQEFoFp QTFtTPKFQLCAREolJiURJhCCJhqAJRMiIhwmjSYdJgqUjQoODgkJJgecBp0mBgYXBx8ZBQxY UAUSDAUACLEPDwgEAAAEIBUEtygkIyMkwMMYw8EjKEEAOw== --ReaqsoxgOBHFXBhH Content-Type: image/jpeg Content-Disposition: attachment; filename="bx.jpg" Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAAR CAAUAAoDAREAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAn/xAAYEAEAAwEAAAAAAAAA AAAAAAAAGWen5//EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA /9oADAMBAAIRAxEAPwCb4AJHym0Vp3PQJTaK07noJHgA/9k= --ReaqsoxgOBHFXBhH Content-Type: image/png Content-Disposition: attachment; filename="day_bg.png" Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABmJLR0QA/wD/AP+gvaeTAAAA CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH2AwCCS0kTriU2QAAAB10RVh0Q29tbWVudABD cmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAAXElEQVR42u3bQQEAMAgDMZiqiZtP5AwbfeQk NO/WvPtLMR0TABEQIAICRECACAgQAREQIAICRECACAgQAREQIAICRECACAgQAREQIAICRECA CAgQARGQ7NpPPasFT+0FZPjBRwYAAAAASUVORK5CYII= --ReaqsoxgOBHFXBhH-- /*****************Mime data end *******************************/ now the problem is i have to parse this data and use it in my application.since this data is not a xml so it difficult to parse it (because parsing with some tag is easy).so any one who knows how to parse mime data help be.i m using erlang to parse this data. Thank you in advance

    Read the article

  • App-Engine Parse a UrlFetch UTF-8 encoded stream

    - by Davidrd91
    I am trying to parse an XML from a URL using the xml.sax parser. I know there are other libraries to use but coming from Java this is the one I am most familiar with and seems the least complicated to me. The code I'm using to parse is as follows: parser = xml.sax.make_parser() handler = MangaHandler() parser.setContentHandler(handler) url = urlfetch.Fetch('http://www.mangapanda.com/alphabetical', allow_truncated = False, follow_redirects = False, deadline = False) xml.sax.parseString(url.content, handler) This returns a SaxException (invalid token) once the parser reaches the first & sign: SAXParseException: <unknown>:582:34: not well-formed (invalid token) Because urlfetch returns a string and not a stream I cannot use the parse() (which only works with streams) and am left to use parseString() instead. To see if parsing as a stream would fix this I tried: parser.parse(io.StringIO(url.content).encode('utf-8')) but this returns: TypeError: initial_value must be unicode or None, not str I have also tried to use the urllib2 libraries which do return a stream instead of urlfetch but the file is too large and is automatically truncated, leaving me with missing data. Any Sort of work-around for this would be greatly appreciated as I've spent days getting around one obstacle just to be stopped by another.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >