Search Results

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

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

  • 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

  • Loading url with cyrillic symbols

    - by Ockonal
    Hi guys, I have to load some url with cyrillic symbols. My script should work with this: http://wincode.org/%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5/ If I'll use this in browser it would replaced into normal symbols, but urllib code fails with 404 error. How to decode correctly this url? When I'm using that url directly in code, like address = 'that address', it works perfect. But I used parsing page for getting this url. I have a list of urls which contents cyrillic. Maybe they have uncorrect encoding? Here is more code: requestData = urllib2.Request( %SOME_ADDRESS%, None, {"User-Agent": user_agent}) requestHandler = pageHandler.open(requestData) pageData = requestHandler.read().decode('utf-8') soupHandler = BeautifulSoup(pageData) topicLinks = [] for postBlock in soupHandler.findAll('a', href=re.compile('%SOME_REGEXP%')): topicLinks.append(postBlock['href']) postAddress = choice(topicLinks) postRequestData = urllib2.Request(postAddress, None, {"User-Agent": user_agent}) postHandler = pageHandler.open(postRequestData) postData = postHandler.read() File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 404: Not Found

    Read the article

  • BeautifulSoup: Get the contents of a specific table

    - by Adam Matan
    Hi, My local airport disgracefully blocks users without IE, and looks awful. I want to write a Python scripts that would get the contents of the Arrival and Departures pages every few minutes, and show them in a more readable manner. My tools of choice are mechanize for cheating the site to believe I use IE, and BeautifulSoup for parsing page to get the flights data table. Quite honestly, I got lost in the BeautifulSoup documentation, and can't understand how to get the table (whose title I know) from the entire document, and how to get a list of rows from that table. Any ideas? Adam

    Read the article

  • Designing a service for consumption on multiple mobile platforms

    - by Nate Bross
    I am building and designing a (mostly) read-only interface to some data. I'll be uing ASP.NET MVC to build a psudo-restful API. I'm wondering if anyone can provide some resources for building full-client applications for various mobile platforms, iPhone, Android, Blackberry, Windows Mobile, etc. I'm thinking that serving up XML data is going to be the most simple and universal, but parsing XML in objective-C for example doesn't sound like fun to me, but maybe there are some good libaries out there to help ease this task? In other words, what formt will be the quickest to implement on the client side? Are there any JSON parsrs for iPhone or Android? I know there are .NET JSON parsers, but not sure about other platforms -- is ther another format that might better? Or should I stick with pure XML and deal with it on each platform differently?

    Read the article

  • How do i get out of the habit of procedural programming and into object oriented programming?

    - by Shadi Almosri
    Hiya all, I'm hoping to get some tips to kinda help me break out of what i consider after all these years a bad habit of procedural programming. Every time i attempt to do a project in OOP i end up eventually reverting to procedural. I guess i'm not completely convinced with OOP (even though i think i've heard everything good about it!). So i guess any good practical examples of common programming tasks that i often carry out such as user authentication/management, data parsing, CMS/Blogging/eComs are the kinda of things i do often, yet i haven't been able to get my head around how to do them in OOP and away from procedural, especially as the systems i build tend to work and work well. One thing i can see as a downfall to my development, is that i do reuse my code often, and it often needs more rewrites and improvement, but i sometimes consider this as a natural evolution of my software development. Yet i want to change! to my fellow programmers, help :) any tips on how i can break out of this nasty habbit?

    Read the article

  • What is the purpose of Java's unary plus operator?

    - by Syntactic
    Java's unary plus operator appears to have come over from C, via C++. As near as I can tell, it has the following effects: promotes its operand to int, if it's not already an int or wider unboxes its operand, if it's a wrapper object complicates slightly the parsing of evil expressions containing large numbers of consecutive plus signs It seems to me that there are better (or, at least, clearer) ways to do all of these things. In this SO question, concerning the counterpart operator in C#, someone said that "It's there to be overloaded if you feel the need." But in Java, one cannot overload any operator. So does this operator exist in Java just because it existed in C++?

    Read the article

  • Insert string from database into an aspx and have databinding expressions within that text evaluated

    - by Christopher Edwards
    Well, as you can see I want something quick-and-dirty! How can I get a string from a db that has aspx databinding syntax in it and have the databinding expressions evaluated? So I have text such as this stored in the DB:- Hello <%=User.Name %> I haven't seen you since <%=User.LastVisit %> And I want it to be inserted here say:- ... <body> <form id="form1" runat="server"> <div> <asp:FormView ID="FormView1" DataSourceID="DataSource1" runat="server"> <ItemTemplate> <-- insert stuff here! --> ... But with the databinding expressions evaluated. I'd rather not build a full parsing, templating and evaluation engine...

    Read the article

  • How to retrieve email from GMail account using PHP?

    - by Tatu Ulmanen
    Hi, I'm trying to automatically retrieve some email from my GMail account for further parsing, but I can't get my head around on how to do that. I've searched the internets and it suggested that I use PHP's imap functions, like this: $server = '{imap.gmail.com:993/ssl}'; $connection = imap_open($server, '[email protected]', 'password'); But using that code, I get: Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/ssl} Any idea what I am doing wrong? Any server setting that might be preventing me from making a connection to GMail (I'm using a shared service)? Is the address even right? Has anyone ever managed to do something like this? I've found tons of examples on how to send email via GMail, but very little of retrieving. Any help is much appreciated.

    Read the article

  • How to access system.webserver web.config node in .NET 2

    - by JK
    Are there any .NET APis that can read/update the system.webServer node in web.config? I know I can do it via reading/parsing the web.config file as xml but that's awkward. To read/update the system.web node in .NET 2 I can use: HttpModulesSection httpModulesSection = (HttpModulesSection)configuration.GetSection("system.web/httpModules"); But is there any API based way of accessing system.web/modules using .NET 2? I have to reference the .NET 2 version of system.web.configuration because I don't know in advance if my web app will be run on a server with .NET 2 or 3.5. So it is limited to .NET 2 API calls only. Thanks

    Read the article

  • How can I create XML from Perl?

    - by pkaeding
    Hello I need to create XML in Perl. From what I read, XML::LibXML is great for parsing and using XML that comes from somewhere else. Does anyone have any suggestions for an XML Writer? Is XML::Writer still maintained? Does anyone like/use it? In addition to feature-completeness, I am interested an easy-to-use syntax, so please describe the syntax and any other reasons why you like that module in your answer. Please respond with one suggestion per answer, and if someone has already answered with your favorite, please vote that answer up. Hopefully it will be easy to see what is most popular. Thanks!

    Read the article

  • Best way to choose a random file from a directory in a shell script

    - by jhs
    What is the best way to choose a random file from a directory in a shell script? Here is my solution in Bash but I would be very interested for a more portable (non-GNU) version for use on Unix proper. dir='some/directory' file=`/bin/ls -1 "$dir" | sort --random-sort | head -1` path=`readlink --canonicalize "$dir/$file"` # Converts to full path echo "The randomly-selected file is: $path" Anybody have any other ideas? Edit: lhunath makes a good point about parsing ls. I guess it comes down to whether you want to be portable or not. If you have the GNU findutils and coreutils then you can do: find "$dir" -maxdepth 1 -mindepth 1 -type f -print0 \ | sort --zero-terminated --random-sort \ | sed 's/\d000.*//g/' Whew, that was fun! Also it matches my question better since I said "random file". Honsetly though, these days it's hard to imagine a Unix system deployed out there having GNU installed but not Perl 5.

    Read the article

  • dynamically create sitemap xml using php

    - by rekhasathvika
    Hi, I have created sitemap for my site using some reference code in the below link http://stackoverflow.com/questions/2747801/creating-an-xml-sitemap-with-php But I am getting error as XML Parsing Error: undefined entity Location: as my content is as follows << alt attribute and it says something like < loc http://www.example.com/700- & laquo;alt & raquo;-attributes-in-images.php< /loc Can anyone tell me how to get rid of this error.

    Read the article

  • Delay after pressing a button

    - by KrLx_roller
    After I press a button, Android parse a JSON file and pick the info it needs. Until yesterday, I was using an external library created by a user and it worked perfectly. But now, I don't want to depend on him, so I've searching info about Google's GSON. I've implemented this library with no problem, but now, after pressing the button that opens a new activity there's a delay. This delay is due to the connection and parsing that are done before the activity shows. How can I force the app to wait the Internet connection until de Activity is shown? It's a lil bit uncomfortable because after pressing the button, it seems that the app has frozen, but after all data is loaded, the new activity appears. Thank you in advance!

    Read the article

  • Why does addSubview load the view asynchronously

    - by moshe
    I have a UIView that I want to load when the user clicks a button. There happens to be some data processing that happens as well after I call addSubview that involves parsing an XML file retrieved from the web. The problem is the view doesn't show up until after the data processing even if addSuview is called first. I think I'm missing something here, can anyone help? Code: I have a "Loading..." view I'm adding as a custom modal (meaning I'm not using the modalViewController). This action is linked to a button in the navigationController. - (IBAction)parseXml:(id)sender { LoadingModalViewController *loadingModal = [[LoadingModalViewController alloc] initWithNibName:@"LoadingModalViewController" bundle:nil]; [navigationController.view addSubview:loadingModal.view]; [xmlParser parse]; }

    Read the article

  • Can Hibernate default a Null String to Empty String

    - by sliver
    In our application we are pulling data from a DB2 mainframe database. If the database has "low values" in a field, hibernate sends a "null" value in the object. This occurs even if the column is defined as "not null". As we are doing XML parsing on this, Castor is having trouble with it. I would like to fix this in Hibernate. Also, all of the hibernate hbm files are generated, so we can't mess with them (they are regened from time to time.) Any way to intercept all Strings and replace nulls with ""?

    Read the article

  • Java Annotations - Is there any helper library to read/process annotations?

    - by mjlee
    I start to use Java annotations heavily. One example is taking method with annotations and converting them into 'telnet'-based command-line command. I do this by parsing annotations and hook into jopt option parser. However, I do a lot of these manually. For example, Method parameter annotation processing.. Method method = ... //; Class[] parameters = method.getParamterTypes(); Annotation[][] annotations = method.getparamterAnnotations(); for( int i = 0; i < parameters.length; i++ ) { // iterate through the annotation , see if each param has specific annotation ,etc. } It is very redundant and tedious. Is there any opensource project that help processing Annotations?

    Read the article

  • C# method contents regex validation

    - by user258651
    I need to validate the contents of a C# method. I do not care about syntax errors. I do care about characters that will invalidate parsing of the rest of the code. For example: method() { /* valid comment */ /* <-- bad for (i..) { } for (i..) { <-- bad } I need to validate/fix any non-paired characters. This includeds /* */, { }, and maybe others. How should I go about this?

    Read the article

  • Should I use Perl or PHP or something else for this project?

    - by Clinton
    I'm about to embark on a project that will need to: Process XML Heavy text parsing of non-xml documents Insertion of data from xml and non-xml documents into a relational DB. Present processed data to user from db using webpages. The website will be subject to short periods of very heavy loads to pages (300+ visitors a minute for several minutes), but most of the time will be idle (a dozen or so visitors a minute). The ability to cache or scale to load will be very nice. I have a very strong background in Java and web services, but I do not want to use Java for this project as I'd like to diversify my skill set. Which language would you recommend and what are some pros and cons that you might recognize from your own experiences?

    Read the article

  • AMF through a BinarySocket written in .net

    - by KensoDev
    Hi All, I have a windows service behaving as a Binary Socket sending data to flex applications. Once I try to send strings or int's or any other native data-type, everything is working great. I even succeeded in sending JSon from the server to the client parsing it on Flex. I want to send AMF objects to the client. Meaning, I have a class called User, I want to fill it with data and send it to the client, there I want it to be mapped to an object on the client. How can I achieve this?

    Read the article

  • Get the property, as a string, from an Expression<Func<TModel,TProperty>>

    - by Jaxidian
    I use some strongly-typed expressions that get serialized to allow my UI code to have strongly-typed sorting and searching expressions. These are of type Expression<Func<TModel,TProperty>> and are used as such: SortOption.Field = (p => p.FirstName);. I've gotten this working perfectly for this simple case. The code that I'm using for parsing the "FirstName" property out of there is actually reusing some existing functionality in a third-party product that we use and it works great, until we start working with deeply-nested properties(SortOption.Field = (p => p.Address.State.Abbreviation);). This code has some very different assumptions in the need to support deeply-nested properties. As for what this code does, I don't really understand it and rather than changing that code, I figured I should just write from scratch this functionality. However, I don't know of a good way to do this. I suspect we can do something better than doing a ToString() and performing string parsing. So what's a good way to do this to handle the trivial and deeply-nested cases? Requirements: Given the expression p => p.FirstName I need a string of "FirstName". Given the expression p => p.Address.State.Abbreviation I need a string of "Address.State.Abbreviation" While it's not important for an answer to my question, I suspect my serialization/deserialization code could be useful to somebody else who finds this question in the future, so it is below. Again, this code is not important to the question - I just thought it might help somebody. Note that DynamicExpression.ParseLambda comes from the Dynamic LINQ stuff and Property.PropertyToString() is what this question is about. /// <summary> /// This defines a framework to pass, across serialized tiers, sorting logic to be performed. /// </summary> /// <typeparam name="TModel">This is the object type that you are filtering.</typeparam> /// <typeparam name="TProperty">This is the property on the object that you are filtering.</typeparam> [Serializable] public class SortOption<TModel, TProperty> : ISerializable where TModel : class { /// <summary> /// Convenience constructor. /// </summary> /// <param name="property">The property to sort.</param> /// <param name="isAscending">Indicates if the sorting should be ascending or descending</param> /// <param name="priority">Indicates the sorting priority where 0 is a higher priority than 10.</param> public SortOption(Expression<Func<TModel, TProperty>> property, bool isAscending = true, int priority = 0) { Property = property; IsAscending = isAscending; Priority = priority; } /// <summary> /// Default Constructor. /// </summary> public SortOption() : this(null) { } /// <summary> /// This is the field on the object to filter. /// </summary> public Expression<Func<TModel, TProperty>> Property { get; set; } /// <summary> /// This indicates if the sorting should be ascending or descending. /// </summary> public bool IsAscending { get; set; } /// <summary> /// This indicates the sorting priority where 0 is a higher priority than 10. /// </summary> public int Priority { get; set; } #region Implementation of ISerializable /// <summary> /// This is the constructor called when deserializing a SortOption. /// </summary> protected SortOption(SerializationInfo info, StreamingContext context) { IsAscending = info.GetBoolean("IsAscending"); Priority = info.GetInt32("Priority"); // We just persisted this by the PropertyName. So let's rebuild the Lambda Expression from that. Property = DynamicExpression.ParseLambda<TModel, TProperty>(info.GetString("Property"), default(TModel), default(TProperty)); } /// <summary> /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with the data needed to serialize the target object. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> to populate with data. </param> /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"/>) for this serialization. </param> public void GetObjectData(SerializationInfo info, StreamingContext context) { // Just stick the property name in there. We'll rebuild the expression based on that on the other end. info.AddValue("Property", Property.PropertyToString()); info.AddValue("IsAscending", IsAscending); info.AddValue("Priority", Priority); } #endregion }

    Read the article

  • non-servlet JSP

    - by h2g2java
    I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc. However, I am not asking for list of alternatives to JSTL/EL. I came across a package more than a year ago, someone who wrote a util that emulates the functionality of JSP for non-servlet env, i.e., JSP composition which does not need a "servlet container" to function. I ignored it and now I think it would be helpful to me and I need help to recall what it is. My actual motivation is similar to what StringTemplate, JUEL, Velocity would offer to help me compose SQL blocks, HTML blocks but I am thinking that JSPs are precompiled into bytecode and JSPs are more run-time efficient since run-time parsing is done no more than once. So actually, recommendation for alternatives would be acceptable as long as the templates are precompiled into bytecode. But I still prefer the JSP emulator.

    Read the article

  • .NET and XML: How can I read nested namespaces (<abc:xyz:name attr="value"/>)?

    - by Entrase
    Suppose there is an element in XML data: <abc:xyz:name attr="value"/> I'm trying to read it with XmlReader. The problem is that I get XmlException that says The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name I have already declared "abc" namespace. I have also tried adding "abc:xyz" and "xyz" namespaces. But this doesn't help at all. I could replace some text before parsing but there may be some more elegant solution. So what should I do? Here is my code: XmlReaderSettings settings = new XmlReaderSettings() NameTable nt = new NameTable(); XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); nsmgr.AddNamespace("abc", ""); nsmgr.AddNamespace("xyz", ""); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); // So this reader can't read <abc:xyz:name attr="value"/> XmlReader reader = XmlReader.Create(path, settings, context);“

    Read the article

  • How to parse a binary file using Javascript and Ajax

    - by Alex Jeffery
    I am trying to use JQuery to pull a binary file from a webserver, parse it in Javascript and display the contents. I can get the file ok and parse some of the file correctly. How ever I am running into trouble with one byte not coming out as expected. I am parsing the file a byte at a time, it is correct until I get to the hex value B6 where I am getting FD instead of B6. Function to read a byte data.charCodeAt(0) & 0xff; File As Hex: 02 00 00 00 55 4C 04 00 B6 00 00 00 The format I want to parse the file out into. short: 0002 short: 0000 string: UL short: 0004 long: 0000B6 Any hints as to why the last value is incorrect?

    Read the article

  • What's the best way to parse RSS/Atom feeds for an iPhone application?

    - by jpm
    So I understand that there are a few options available as far as parsing straight XML goes: NSXMLParser, TouchXML from TouchCode, etc. That's all fine, and seems to work fine for me. The real problem here is that there are dozens of small variations in RSS feeds (and Atom feeds too), so supporting all possible permutations of feeds available out on the Internet gets very difficult to manage. I searched around for a library that would handle all of these low-level details for me, but came out without anything. Since one could link to an external C/C++ library in Objective-C, I was wondering if there is a library out there that would be best suited for this task? Someone must have already created something like this, it's just difficult to find the "right" option from the thousands of results in Google. Anyway, what's the best way to parse RSS/Atom feeds in an iPhone application?

    Read the article

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