Search Results

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

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

  • Best way to parse command line arguments in C#

    - by Paul Stovell
    When building console applications that take parameters, you can use the arguments passed to Main(string[] args). In the past I've simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pretty ugly. More recently, I built the world's simplest Backus-Naur Form parser in C# to parse the arguments. It does the job, but it also feels like overkill. So I'm interested in: Libraries that you use Patterns that you use Assume the commands always adhere to common standards such as answered here.

    Read the article

  • Injecting an XML fragment into the current document from an external file

    - by makenai
    I'm currently parsing an XML file using REXML and trying to come up with a way of inserting an XML fragment from an internal file. Currently, I'm using some logic like the following: doc.elements.each('//include') do |element| handleInclude( element ) end def handleInclude( element ) if filename = element.attributes['file'] data = File.open( filename ).read doc = REXML::Document.new( data ) element.parent.replace_child( element, doc ) end end Where my XML looks like the following: <include file="test.xml" /> But this seems a little bit clunky, and I'm worried that REXML might not always parse XML fragments correctly due to absence of a proper root node in some cases. Is there a better way of doing this? Concern #2: REXML seems not to pick up my changes after I replace elements. For example, after making a change: doc.elements.each('rootNode/*') do |element| end ..picks up neither the original element I replaced, nor the one I replaced it with. Is there some trick to getting REXML to rescan its' tree?

    Read the article

  • Forcing Spring web services to add the xsd namespace to the response

    - by David Rabinowitz
    I'm using the Spring WS version 1.5.8. My response looks like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> ... </SOAP-ENV:Body> </SOAP-ENV:Envelope> However, my client (whom I integrate with) requires that I will add more namespace declerations in order for the parsing to succeed: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> ... </soapenv:Body> </soapenv:Envelope> How can I do it?

    Read the article

  • How to parse a text file and write the result to an xls file?

    - by Bk
    Hi all i am a junior level SQL developer. I have a situation where I have a text file with 1100 lines of a search result with each line containing a file path and a stored procedure associated with that file. Each line has a structure like the one below: abc\def\ghi\***.cs(40): jkl=******.*****.******, "proc_pqrst", parms); Where abc\def\ghi\***.cs is file path of the file ***.cs. The stored procedure names begin with proc_. I have to extract the ***.cs and the corresponding stored procedure name begining with proc_ and write them to a .xls file. Can some body help me in writing the parsing program to do this? Also can I get a detailed outline on where should I write the code for c# and where should I compile it? This could be a great help as I don't have any knowledge of C#. Thank you, BK.

    Read the article

  • Use case modelling for calculator

    - by kyrogue
    hi, i need help modelling a use case diagram from a topic, it will be in java GUI Design a Calculator that 1.Allow user to key in a legitimate arithmetic statement that involves number, operator +, - and bracket '(' and ')' ; 2.When user press “Calculate” button, display result; 3.Some legitimate statement would be ((3+2)-4+2) (equals 3) and (-2+3)-(3-1) (equals -1); 4.You should NOT use a pre-existing function that just take in the statement as a parameter and returns the result but you should write the logic of parsing every character in your code. 5.Store the last statement and answer so it is displayed when user press the “Last calculation” button. i have designed two use case diagrams using UML on netbeans 6.5.1, one of the use case i am not sure whether is it containing too much use cases etc, while the other is what i think could be too vague for the topic.i hope to get some feedback on whether the use case diagram are appropriate, thanks.

    Read the article

  • Best Practice For Referencing an External Module In a Java Project

    - by Greg Harman
    I have a Java project that expects external modules to be registered with it. These modules: Implement a particular interface in the main project Are packaged into a uni-jar (along with any dependencies) Contain some human-readable meta-information (like the module name). My main project needs to be able to load at runtime (e.g. using its own classloader) any of these external modules. My question is: what's the best way of registering these modules with the main project (I'd prefer to keep this vanilla Java, and not use any third-party frameworks/libraries for this isolated issue)? My current solution is to keep a single .properties file in the main project with key=name, value=classhuman-readable-name (or coordinate two .properties files in order to avoid the delimiter parsing). At runtime, the main project loads in the .properties file and uses any entries it finds to drive the classloader. This feels hokey to me. Is there a better way to this?

    Read the article

  • Find/parse server-side <?abc?>-like tags in html document

    - by Iggyhopper
    I guess I need some regex help. I want to find all tags like <?abc?> so that I can replace it with whatever the results are for the code ran inside. I just need help regexing the tag/code string, not parsing the code inside :p. <b><?abc print 'test' ?></b> would result in <b>test</b> Edit: Not specifically but in general, matching (<?[chars] (code group) ?>)

    Read the article

  • Need help converting apache .htaccess code to lighttpd url_rewrite code

    - by miCRoSCoPiC_eaRthLinG
    Hi All, I have this custom written CMS built on XAMPP. I'm trying to test the same on lighttpd to benchmark the so-called performance gains... but am stuck at the rewrite rules. I use the default rewrite rules of WordPress in my .htaccess which hands all url parsing over to my script as long as there aren't any files or directories same as the URL structure. Here's the code: RewriteBase /somedir/ # Let the Script handle all pretty URLs RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule .* index.php [L] Can anyone please help me translate the same to the lighttpd format? I could only (partially) figure out the last line myself going through the lighty docs ... i.e. url.rewrite-once = ( ".*" => "index.php" ) But that of course won't suffice... All my CMS is doing is giving me 404's. Thanks, miCRoSCoPiC^eaRthLinG

    Read the article

  • concatenating strings from two different rows in a table

    - by Azeem
    Hello, We are attempting to rework the SQL in a product. The product stores XML in a table as follows: XML_STORAGE - UID IDENTITY - PARENT_ID INTEGER - SEQ INTEGER - XML VARCHAR(3800) The current way of doing this is as follows: Retrieve all ROWS for PARENT_ID = n. Then go over the fetched rows in the code and concatenate the XML strings into one large XML before parsing. The SEQ column is used to ORDER the result so the XML strings can be concatenated properly. Hopefully that is clear. What we are attempting to do is rework this so we can use a SQL variant to retrieve the whole string and just fetch one row back from DB2. Is there a DB2 function that will allow us to concatenate the string in all of these rows into one large string in the resultset. How would such a SQL look. Please let me know. Any help is much appreciated. Thanks! - Azeem

    Read the article

  • EntityFramework .net 4 Update entity with a simple method

    - by Dennis Larsen
    I was looking at this SO question: http://stackoverflow.com/questions/1168215/ado-net-entity-framework-update-only-certian-properties-on-a-detached-entity. This was a big help for me. I know now that I need to attach an entity before making my changes to it. But how can do I do this: I have an MVC website, a Customer Update Page with fields: ID, Name, Address, etc. My MVC is parsing this into a Customer entity. How do I do the following: Update my entity and Save the changes to it. Catch the exception if my changes have been made since I loaded my entity.

    Read the article

  • How to evaluate a custom math expression in Python

    - by taynaron
    I'm writing a custom dice rolling parser (snicker if you must) in python. Basically, I want to use standard math evaluation but add the 'd' operator: #xdy sum = 0 for each in range(x): sum += randInt(1, y) return sum So that, for example, 1d6+2d6+2d6-72+4d100 = (5)+(1+1)+(6+2)-72+(5+39+38+59) = 84 I was using regex to replace all 'd's with the sum and then using eval, but my regex fell apart when dealing with parentheses on either side. Is there a faster way to go about this than implementing my own recursive parsing? Perhaps adding an operator to eval?

    Read the article

  • xml pahsing issue..

    - by 3gwebtrain
    HI, any one help me in this xml parsing issue? my xml is : name my jquery is : $(function(){ $.get("shop.xml", function(data){ var shopInfo = $(data).find("shop").attr('title'); var showowner = $(data).find("raj").attr('title'); alert(shopInfo+':'+showowner); }) }) when i alret in firefox it alret the shopInfo as "null" and showowner "title" and i case if i check with ie, and chrome, i am getting "null:null" in the alert message. any one tell me what is the wrong i am doing here? i need my jquery need to get xml data properly from to all browsers, for that any suggestion please?

    Read the article

  • How to split but ignore separators in quoted strings, in python?

    - by Sly
    I need to split a string like this, on semicolons. But I don't what to split on semicolons that are inside of a string (' or "). I'm not parsing a file; just a simple string with no line breaks. part 1;"this is ; part 2;";'this is ; part 3';part 4 Result should be: part 1 "this is ; part 2" 'this is ; part 4' part 4 I suppose this can be done with a regex but if not; I'm open to another approach.

    Read the article

  • JAXB appending unneeded namespace declarations to tags

    - by jb
    I'm implementing a homebrew subprotocol of XMPP, and i'm using combination of StAX and JAXB for parsing/marshalling mesages. And when I marshall a message I end up with loads of unneded namespace declarations: <ns2:auth xmlns:ns2="urn:ietf:params:xml:ns:ilf-auth" xmlns:ns4="ilf:iq:experiment:power" xmlns:ns3="ilf:iq:experiment:init" xmlns:ns5="ilf:iq:experiment:values" xmlns:ns6="ilf:iq:experiment:result" xmlns:ns7="ilf:iq:experiment:stop" xmlns:ns8="ilf:iq:experiment:end"> compton@ilf</ns2:auth> instead of: <ns:auth xmlns:ns="urn:ietf:params:xml:ns:ilf-auth>compton@ilf</ns:auth> Is there any way to turn that of? All these namespaces are used in different messages that get marshalled/unmarshalled by JAXB, but every message uses one namespace. PS. I am not an XML expert please dont rant me if I did some stupid mistake ;)

    Read the article

  • Custom validation summary

    - by Robert Morgan
    I'm using the UpdateModel method for validation. How do I specify the text for the error messages as they appear in the validation summary? Sorry, I wasn't entirely clear. When I call UpdateModel(), if there is parsing error, for example if a string value is specified for a double field, a "SomeProperty is invalid" error message is automatically added to the ModelState. How do I specify the text for said automatically generated error message? If I implement IDataErrorInfo as suggested, it's error message property gets called for every column, regardless of whether the default binder deems it valid or not. I'd have to reimplement the parse error catching functionality that I get for free with the default binder. Incidentally, the default "SomeProperty is invalid" error messages seem to have mysteriously dissappeared in the RC. A validation summary appears and the relevant fields are highlighted but the text is missing! Any idea why this is? Thanks again and I hope all this waffle makes sense!

    Read the article

  • getElementsByTagName problem in chrome and safari

    - by Ilian Iliev
    I`m parsing a Google Maps RSS with javascript and using the following code to get the point coordinates: point_coords = items.getElementsByTagName('georss:point') Unfortunately it works in FF but not in safari and chrome (still not tested in Opera and IE) The XML looks like: <item> <guid isPermaLink="false">guidNo</guid> <pubDate>Mon, 23 Mar 2009 20:16:41 +0000</pubDate> <title>title text</title> <description><![CDATA[text]]></description> <author>UniCreditBulbank</author> <georss:point> 42.732342 23.296659 </georss:point> </item>

    Read the article

  • Handling duplicate nodes in XML

    - by JYelton
    Scenario: I am parsing values from an XML file using C# and have the following method: private static string GetXMLNodeValue(XmlNode basenode, string strNodePath) { if (basenode.SelectSingleNode(strNodePath) != null) return (basenode.SelectSingleNode(strNodePath).InnerText); else return String.Empty; } To get a particular value from the XML file, I generally pass the root node and a path like "parentnode/item" I recently ran into an issue where two nodes at the same document level share the same name. Question: What is the best way to get the values for duplicate-named nodes distinctly? My thought was to load all values matching the node name into an array and then using the array index to refer to them. I'm not sure how to implement that, though. (I'm not well-versed in XML navigation.)

    Read the article

  • memory issue iPad 4.2 crashes

    - by Manoj Kumar
    I am developing a application which receives 600-700 KB of XML data from the server. I have to do some manipulations in that data so once received the data the memory increases to 600 KB to 2 M.B. Already view occupied 4 M.B of memory in the application. So while processing the XML data i m doing some manipulation(pre-parsing) and the memory increases to 600 K.B to 2 M.B and finally decreases to 600 K.B. due to increase in memory, application gives the memory warning. While getting memory warning i m releasing all the views in the navigation controller but it releases only 1 M.B of memory. Even though I release all the views the application is crashing. Please help me out in this issue. It happens in iPad 4.2. Thanks in advance

    Read the article

  • JSTL Session Lookup - Key Has Periods

    - by John W.
    Hello All, I am working with some legacy code, and at some point there is a key in the session that is something like session.setAttribute("com.org.something.Object",someObject); Now trying to access this in a jsp using jstl is a bit difficult becuase if I tried it like I normally would I would do: ${sessionScope.com.org.something.Object.someFieldGetter} As most of us can imagine it will fail because there is no com object in session scope. I also tried ${sessionScope.'com.org.something.Object'.someFieldGetter} And a parsing error was thrown. Does anyone know how to resolve this so that I can correctly get the object similar to session.getAttribute("com.org.something.Object") but through jstl? thank you.

    Read the article

  • Is it possible to use DLR in a .NET 3.5 website project?

    - by Aplato
    I'm trying to evaluate an expression stored in a database i.e. "if (Q1 ==2) {result = 3.1;} elseif (Q1 ==3){result=4.1;} else result = 5.9;" Rather than parsing it myself I'm trying to use the DLR. I'm using version .92 from the Codeplex repository and my solution is a .NET 3.5 website; and I'm having conflicts between the System.Core and Microsoft.Scripting.ExtenstionAttribute .dll's. Error = { Description: "'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.", File: "InternalXmlHelper.vb" } At this time I cannot upgrade to .NET 4.0 and make significant use of the .net 3.5 features (so downgrading is not an option). Any help greatly appreciated.

    Read the article

  • Oracle: show parameters on error

    - by llappall
    When Oracle logs a parameterized SQL query failing, it shows "?" in place of the parameters, i.e. the query before replacing parameters. For example, "SELECT * FROM table where col like '?'" SQL state [99999]; error code [29902]; ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: Oracle Text error: DRG-50901: text query parser syntax error on line 1, column 48 Is there a way to change logging so it shows the parameter values? The information above is absolutely useless unless I can see what the actual parsing problem was. In general, is there a way to set logs in Oracle to show parameters in parameterized query errors?

    Read the article

  • Semantic stuff (RDF, OWL) on mobile phones - is it possible?

    - by Brian Schimmel
    I'm thinking about using semantic (web) technogies like RDF and OWL in an application on mobile devices. Currently I'm targeting android, but I'd also be interested in the possibilities on the iPhone and on J2ME. I would like to use a lib instead of implementing everything from scratch. I know that there are some libraries and frameworks like Jena, Redland, Protégé but they don't state on which platforms they are known to work. Having a dynamic object model and parsing from and to XML are must-haves for me. I'd also like to use reasoning, but I've been told it was rather computing-intensive, so that's only a nice-to-have. For all platforms mentioned, the question can be interpreted as Is it possible in theory (especially for J2ME I'm not sure) Are there libs that are known to work on those platforms? Is the performance on a mobile platform good enough for real world usage?

    Read the article

  • bad performance from too many caught errors?

    - by Christopher Klein
    I have a large project in C# (.NET 2.0) which contains very large chunks of code generated by SubSonic. Is a try-catch like this causing a horrible performance hit? for (int x = 0; x < identifiers.Count; x++) {decimal target = 0; try { target = Convert.ToDecimal(assets[x + identifiers.Count * 2]); // target % } catch { targetEmpty = true; }} What is happening is if the given field that is being passed in is not something that can be converted to a decimal it sets a flag which is then used further along in the record to determine something else. The problem is that the application is literally throwing 10s of thousands of exceptions as I am parsing through 30k records. The process as a whole takes almost 10 minutes for everything and my overall task is to improve that time some and this seemed like easy hanging fruit if its a bad design idea. Any thoughts would be helpful (be kind, its been a miserable day) thanks, Chris

    Read the article

  • Is google gson running on android?

    - by Janusz
    I'm playing arround with google gson for communication with my web back end at the moment. This and this older posts indicate that there are some problems with gson on android. I did some easy tests on the device already but maybe I just missed the bug. Edit I'm now parsing a lot more data. Generic lists etc. still not encountered the bug. Has anybody used gson on Android already? How does it work? Has somebody encountered bugs or something that will stop me from using it once it gets more complicated?

    Read the article

  • Is it possible to put myBatis (iBatis) xml mappers outside the project?

    - by kospiotr
    According to the user guide i am able to use file path instead of resource: // Using classpath relative resources <mappers> <mapper resource="org/mybatis/builder/AuthorMapper.xml"/> </mappers> // Using url fully qualified paths <mappers> <mapper url="file:///var/sqlmaps/AuthorMapper.xml"/> </mappers> in my project I'm trying to put my mapper xml "outside" the project and i'm doing this: <mapper url="file://D:/Mappers/ComponentMapper1.xml" /> The output of my log4j console: Error building SqlSession. The error may exist in file://D:/Mappers/ComponentMapper1.xml Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.net.UnknownHostException: D Is it bug or it's me doing something wrong?

    Read the article

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