Search Results

Search found 21350 results on 854 pages for 'url parsing'.

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

  • Regular expression for parsing CSV in PHP

    - by Discodancer
    I already managed to split the CSV file using this regex: "/,(?=(?:[^\"]\"[^\"]\")(?![^\"]\"))/" But I ended up with an array of strings that contain the opening and ending double quotes. Now I need a regex that would strip those strings of the delimiter double quotes. As far as I know the CSV format can encapsulate strings in double quotes, and all the double quotes that are already a part of the string are doubled. For example: My "other" cat becomes "My ""other"" cat" What I basically need is a regex that will replace all sequences of N doublequotes with a sequence of (N/2 - rounded down) double quotes. Or is there a better way ? Thanks in advance.

    Read the article

  • HTML5 Shiv not parsing quick enough

    - by Mikey Hogarth
    One of our web designers is working on a site at the moment and is using HTML5 elements, which she styles up in older browsers using the well documented Html5Shiv; http://css-tricks.com/html5-innershiv/ She reported some pretty weird behavior today and it looks like this is the cause. Initially it was very confusing, and went something along the lines of; "The page looks fine, I refresh it looks fine, refresh several times and occasionally it will not apply my styles to the HTML5 elements" Current best theory is that the shiv is not kicking in quick enough, and the page loads before the new elements have been registered. I was wondering if anyone could suggest a surefire way of including the shiv and making sure it's loaded and been parsed BEFORE the rest of the elements, so they will definitely get styled. EDIT (more info) Shiv is being included in the head, directly below the title/meta tags; <!--[if IE]> <script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> The bit that is being styled is in the footer and is cross-site. Many of the pages will change in size as they're being powered by a CMS that our marketing team will use so I am unable to give an exact page size. All I would say is that if page size is an issue and there is no workaround, can someone let me know as this will mean we basically can't use HTML5 on this project (or at the very least we'll need to add superflous markup such as divs to ensure that the layout doesn't go crazy) EDIT 2 There is no chance of me posting the code unfortunately - it's only re-creatable under really obscure circumstances and the project is marked "top secret" at the moment :( If nobody knows then I'm guessing it's either a case of "everyone knows it happens but kinda ignores it" or just that it's something else other than the shiv.

    Read the article

  • parsing FireFox bookmarks using regular expression

    - by SIFE
    I tried to parse firefox bookmark(JSON exported version), using this efforts: cat boo.json | grep '\"uri\"\:\"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}\"' cat boo.json | grep '"uri"\:"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}' cat boo.json | grep '"uri"\:"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}"' And few others but all fails, json bookmarked file will look like this: .........."uri":"http://www.google.com/?"......"uri":"http://stackoverflow.com/" So, the output should be like this: "uri":"http://www.google.com/?" "uri":"http://stackoverflow.com/" What is the missing part on my regular expression?

    Read the article

  • Parsing WordPress XML, slash:comments syntax?

    - by user313653
    This is really just a syntax question. I have a PHP script that parses my WordPress feed and returns the latest posts. I also want my script to parse the # of comments, but the WordPress feed XML object for number of comments has a colon in it (slash:comments). It causes the following error: Parse error: syntax error, unexpected ':' in ... on line ... I have tried each of the following without luck: $xml->slash:comments $comments = 'slash:comments' $xml->$comments $xml->slash.':'.comments $xml->{slash:comments} $xml->{'slash:comments'} How do I parse an object with a colon?

    Read the article

  • How to stop htaccess rewrite rule carrying over query string

    - by geoffs3310
    I am setting up some redirects. I want to redirect the following URL: /cms/index.php?cat_id=2 to the following URL: /flash-chromatography The rule I currently have is as follows: RewriteCond %{QUERY_STRING} ^cat_id=2$ [NC] RewriteRule ^cms/index\.php$ /flash-chromatography [L,R=301] This rule is almost perfect apart from it redirect the URL to the following: /flash-chromatography?cat_id=2 So you see my problem is it has kept the ?cat_id=2 part when I don't want it to. How do I stop it keeping this bit?

    Read the article

  • Parsing a list of dictionaries passed as a POST parameter

    - by andyashton
    I have a list of python dictionaries that look like this: sandwiches = [ {'bread':'wheat', 'topping':'tomatoes', 'meat':'bacon'}, {'bread':'white', 'topping':'peanut butter', 'meat':'bacon'}, {'bread':'sourdough', 'topping':'cheese', 'meat':'bacon'} ] I want to pass this as a POST parameter to another Django app. What does the client app need to do to iterate through the list? I want to do something like: for sandwich in request.POST['sandwiches']: print "%s on %s with %s is yummy!" % (sandwich['meat'], sandwich['bread'], sandwich['topping']) But I don't seem to have a list of dicts when my data arrives at my client app.

    Read the article

  • string parsing occurrence in c

    - by Dan74
    I have a string as const char *str = "Hello, this is an example of my string"; How could I get everything after the first comma. So for this instance: this is an example of my string I was planing to do something like: // pseudocode char *a, *b; loop { if((a = strchr(l, ',')) == NULL) break; b++; // but not sure here } printf("%s",a); Thanks

    Read the article

  • How to supply parameters in URI schema?

    - by abhishekgarg
    I just started working with URI schema and successfully created one in Windows and Linux as well, but I am not able to parse any parameters to it. In Linux I am trying to open a file "test.py" in gedit, so for schema part I used these commands: gconftool -2 -t string /desktop/gnome/url-handlers/geditapp/command "gedit %s" gconftool -2 -t bool/desktop/gnome/url-handlers/geditapp/enabled true This is creating the URI protocol and I'm able to open the application with the Web-browser, but its not taking the parameters for the file I want to open, so I'm using the following command: <a href="geditapp:/opt/test/myfile.py">open</a> Which opens the gedit but without the file. Can someone please help me with this?

    Read the article

  • How can I allow undefined options when parsing args with Getopt

    - by Ross Rogers
    If I have a command line like: my_script.pl -foo -WHATEVER My script knows about --foo, and I want Getopt to set variable $opt_foo, but I don't know anything about -WHATEVER. How can I tell Getopt to parse out the options that I've told it about, and then get the rest of the arguments in a string variable or a list. An example: use strict; use warnings; use Getopt::Long; my $foo; GetOptions('foo' => \$foo); print 'remaining options: ', @ARGV; Then, issuing perl getopttest.pl -foo -WHATEVER gives Unknown option: whatever remaining options:

    Read the article

  • Prevent DTD download when parsing XML, redux

    - by harpo
    I have a folder full of XHTML files, and a console program to process them. The problem is, it doesn't work when I'm offline, because The remote name could not be resolved: 'www.w3.org' A number of sites, including this one, say to set the XmlResolver to null. That is not not working. I have tried setting the XmlResolver to null every way that I can think of: in the XmlDocument, in XmlTextReader, and in the XmlReaderSettings. I believe that it's just creating a default instance. I have also tried implementing my own XmlResolver, but I don't know what to return for external items. public class NonXmlResolver : XmlUrlResolver { public override object GetEntity( Uri absoluteUri, string role, Type ofObjectToReturn ) { if ( absoluteUri.Scheme == "http" ) throw new Exception("What you talking 'bout, Willis?"); else return base.GetEntity( absoluteUri, role, ofObjectToReturn ); } } The documents do not use any special entities, only pure XML. This is possible, right?

    Read the article

  • jQuery $.getJSON - How do I parse a flickr.photos.search REST API call?

    - by Chad
    Trying to adapt the $.getJSON Flickr example: $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", function(data){ $.each(data.items, function(i,item){ $("<img/>").attr("src", item.media.m).appendTo("#images"); if ( i == 3 ) return false; }); }); to read from the flickr.photos.search REST API method, but the JSON response is different for this call. Click here to see the JSON response. This is what I've done so far: var url = "http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=9322c53dde3b36bda33f79c16bb99104&tags=yokota+air+base&safe_search=1&per_page=20"; var src; $.getJSON(url + "&format=json&jsoncallback=?", function(data){ $.each(data.photos, function(i,item){ src = "http://farm"+ item.photo.farm +".static.flickr.com/"+ item.photo.server +"/"+ item.photo.id +"_"+ item.photo.secret +"_m.jpg"; $("<img/>").attr("src", src).appendTo("#images"); if ( i == 3 ) return false; }); }); I guess I'm not building the image src correctly. Couldn't find any documentation on how to build the image src, based on what the JSON response is. How do you parse a flickr.photos.search REST API call?

    Read the article

  • Parsing and replacing Javascript identifiers with Rhino in Java

    - by Parhs
    Suppose I let the user to write a condition using Javascript, the user can write conditions to perform a test and return true or false. E.g.: INS>5 || ASTO.valueBetween(10,210) I want to find which variables are used in the script that the user wrote. I tried to find a way to get the identifier names in Java. The Rhino library didn't help a lot. However I found that via handling exceptions I could get all the identifiers. So this problem is solved. So everything is great, but there is one little problem. How can I replace these identifiers with a numeric identifier? E.g. INS should be _234 and ASTO should be _331. INS and ASTO etc are entities in my database. I want to replace them, because the name may change. I could do it using a replace but this isn't easy because: It should be reversible. E.g. ASTO to _234 and _234 to ASTO again. Replacing _23 with MPLAH may also replace _234. This could be fixed with regexp somehow. What if _23 is in a comment section? Rare to happen, but possible /* _23 fdsafd ktl */. It should also be replaced. What if it is a name of a function? E.g. _32() {}. Also rare, but it shouldn't be replaced. What if it is enclosed in "" or ''? I am sure that there are a lot more cases. Any ideas?

    Read the article

  • How to replace 'dash' with 'underscore' in an IIRF rule?

    - by jessegavin
    I have a web app which serves images based on the subdomain. We wanted to provide our users with a url like this: http://{username}.domain.com/images/myimage.jpg Instead of what we used to have: http://www.reallylongdomainname.com/users/{username}/images/myimage.jpg This makes the url shorter and less 'snoopable'. So I set up an IIRF .ini file to do some url rewriting and it works great except for the fact that some of our users folders have an underscore. And from what I've read, underscore is not a valid character in a domain name (even though IIS supports it). I want to know how I could do a find and replace in the $1 back reference so that a url like this: http://some-user.domain.com/... Could be rewritten to this: /users/some_user/.. Here's my IIRF rule. RewriteCond %{HTTP_HOST} ^(?!www)([^\.]+)\.domain\.com RewriteRule ^/(.*)$ /users/*1/$1 [L,I] Thanks for any help.

    Read the article

  • Parsing JSON with eval

    - by Neethusha
    I have this code: function useHttpResponse() { if (xmlhttp.readyState==4 ) { var response = eval('('+xmlhttp.responseText+')'); alert(response); for(i=0;i<response.Users.length;i++) alert(response.Users[i].UserId); } } When i alert, the first alert is "[object Object]" Why is that so? I need to remove that...how?

    Read the article

  • Servlet Mapping Help - Possible to Avoid Referencing Context Name?

    - by AJ
    Hi all, I am working on a Spring application and trying to get my URL mapping correct. What I would like to have work is the following: http://localhost:8080/idptest -> doesn't work But instead, I have to reference the context name in my URL in order to resolve the mapping: http://localhost:8080/<context_name>/idptest -> works How can I avoid the requirement of referencing the context name in my URL without using a rewrite/proxy engine e.g. Apache? Here is the servlet definition and mapping from my web.xml: <servlet> <servlet-name>idptest</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/conf/idptest.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>idptest</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> Here's the outline of my controller (showing annotations for request mappings): @Controller @RequestMapping("/idptest") public class MyController { @RequestMapping(method=RequestMethod.GET) public String setupForm(Model model){ MyObject someObject = new MyObject(); model.addAttribute("someObject", someObject); return "myform"; } @RequestMapping(method = RequestMethod.POST) public String processSubmit(@ModelAttribute("someObject") MyObject someObject) throws Exception { // POST logic... } } Thanks!

    Read the article

  • Java Time Zone When Parsing DateFormat

    - by shipmaster
    I had code that parses date as follows: String ALT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; SimpleDateFormat sdf = new SimpleDateFormat( ALT_DATE_TIME_FORMAT); Date date = sdf.parse(requiredTimeStamp); And it was working fine, suddenly, this stopped working. It turns out an admin made some config changes on the server and the date is currently being returned as "2010-12-27T10:50:44.000-08:00" which is not parse-able by the above pattern. I have two questions: The first would be what pattern would parse the date being returned by the JVM in the format above (specifically, just '-08:00' as the time zone)? And second, where exactly would one change such settings on a linux RHEL 5 server so that we are aware of such changes in the future?

    Read the article

  • Parsing google feed with linq to xml

    - by the_V
    Hi I'm trying to parse XML feed that I get via Google Contacts API with LINQ 2 XML. That's what feed looks like: <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005"> <id>[email protected]</id> <updated>2010-06-11T17:37:06.561Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact" /> <title type="text">My Contacts</title> <link rel="alternate" type="text/html" href="http://www.google.com/" /> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full" /> <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full" /> <link rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full/batch" /> <link rel="self" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full?max-results=25" /> <author> <name>My NAme</name> <email>[email protected]</email> </author> <generator version="1.0" uri="http://www.google.com/m8/feeds">Contacts</generator> <openSearch:totalResults>19</openSearch:totalResults> <openSearch:startIndex>1</openSearch:startIndex> <openSearch:itemsPerPage>25</openSearch:itemsPerPage> <entry> <id>http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/base/0</id> <updated>2010-01-26T20:34:03.802Z</updated> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact" /> <title type="text">Contact name</title> <link rel="http://schemas.google.com/contacts/2008/rel#edit-photo" type="image/*" href="http://www.google.com/m8/feeds/photos/media/myemailaddress%40gmail.com/0/O-ydnzWMJcfZWqT-6gGetw" /> <link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="http://www.google.com/m8/feeds/photos/media/myemailaddress%40gmail.com/0" /> <link rel="self" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full/0" /> <link rel="edit" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full/0/1264538043802000" /> <gd:email rel="http://schemas.google.com/g/2005#other" address="[email protected]" primary="true" /> </entry> </feed> I've tried a number of things with linq 2 sql, but they didn't work. Even this simple code snipped doesn't work: using (FileStream stream = File.OpenRead("response.xml")) { XmlReader reader = XmlReader.Create(stream); XDocument doc = XDocument.Load(reader); XElement feed = doc.Element("feed"); if (feed == null) { Console.WriteLine("feed not found"); } XElement id = doc.Element("id"); if (id == null) { Console.WriteLine("id is null"); } } Problem is that both id and feed are null here. What wrong am I doing?

    Read the article

  • Parsing mutiple xml files in android

    - by cppdev
    Hi, I ma writing an application where I have to parse multiple xml files as a response from a server. Till now, I have written different xml parser classes for each xml depepending on the tags present in different xmls ? Can I combine all xml parser classes and write a single xml parser that handles all different tags in different xmls ? Will it work ? Will combining xml parser classes add an overhead because xml parser will check for every tag irrespective of whether that is part of file or not ? Please help.

    Read the article

  • Parsing pipe delimited string into columns?

    - by DMS
    Hello, I have a column with pipe separated values such as: '23|12.1| 450|30|9|78|82.5|92.1|120|185|52|11' I want to parse this column to fill a table with 12 corresponding columns: month1, month2, month3...month12. So month1 will have the value 23, month2 the value 12.1 etc... Is there a way to parse it by a loop or delimeter instead of having to separate one value at a time using substr? Thanks.

    Read the article

  • URL with no query parameters - How to distinguish.

    - by Broken Link
    Env: .NET 1.1 I got into this situation. Where I need to give a URL that someone could redirect them to our page. When they redirect they also need to tell us, what message I need to display on the page. Initially I thought of something like this. http://example.com/a.aspx?reason=100 http://example.com/a.aspx?reason=101 ... http://example.com/a.aspx?reason=115 So when we get this url based on 'reason' we can display different message. But the problem turns out to be that they can not send any query parameters at all. They want 15 difference URL's since they can't send query params. It doesn't make any sense to me to created 15 pages just to display a message. Any smart ideas,that have one URL and pass the 'reason' thru some means? EDIT: Options I'm thinking based on Answers Try HttpRequest.PathInfo or Second option I was thinking was to have a httphanlder read read the path like this - HttpContext.Request.Path based on path act. Ofcourse I will have some 15 entries like this in web.config. <add verb="*" path="reason1.ashx" type="WebApplication1.Class1, WebApplication1" /> <add verb="*" path="reason2.ashx" type="WebApplication1.Class1, WebApplication1" /> Does that look clean?

    Read the article

  • Parsing JSON object in JQuery

    - by koby
    Hi, I have simple JSON object returned in form {"d":"{\"Name\":\"DMX100\",\"Description\":\"blah blah\",\"ID\":\" 780\",\"Make\":\"2010\"}"} How do I parse it in success. success: function(msg) { $('#something').html(msg.d.Name); } Above code doesnt display Name but when I pass $('#something').html(msg.d); it shows complete Json string. How do I reach to individual properties Thanks

    Read the article

  • Parsing the response from a jQuery ajax form post

    - by GrahamB
    I am successfully posting a form via ajax, using the following code; $.post( "Page.do?source=ajax", $("#Form").serialize(), function(data){ } The data response that comes back can be alert'd. I can see that it is the HTML of the entire form, having been submitted. But, I am having trouble accessing an element in that form which has come via ajax, ie data.find('.Errors').html() or $('.Errors', data).html() Do I need to somehow convert the text into a DOM which can then be parsed by jQuery?

    Read the article

  • A simple way to redirect http://mysite.com to http://mysite.com/mylink with Apache?

    - by Bart Silverstrim
    Just starting to try to get the hang of how all the directives and options work under Apache. I'd like to do a redirect with my one site (only running one site on the server) so that when a request comes in to http://mysite.com the server automatically redirects them to a sub-url of http://mysite.com/mylink. I have tried putting redirects into the file located in /etc/apache2/sites-enabled to rewrite this, but then the top level domain URL complains it isn't redirecting properly. I think what I want is a browser redirect, and thought using RewriteEngine On RewriteRule ^/$ /mylink [L,R] would work, but putting it into an .htaccess file didn't work (it redirected but immediately gave a 500 internal server error.) Putting it into the file in /etc/apache2/sites-enabled gives a configuration error when trying to restart Apache. I know it's something simple...but what am I missing?

    Read the article

  • problem parsing JSON Strings

    - by blacktooth
    var records = JSON.parse(JsonString); for(var x=0;x<records.result.length;x++) { var record = records.result[x]; ht_text+="<b><p>"+(x+1)+" " +record.EMPID+" " +record.LOCNAME+" " +record.DEPTNAME+" " +record.CUSTNAME +"<br/><br/><div class='slide'>" +record.REPORT +"</div></p></b><br/>"; } The above code works fine when the JsonString contains an array of entities but fails for single entity. result is not identified as an array! Whats wrong with it? http://pastebin.com/hgyWw5hd

    Read the article

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