Search Results

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

Page 100/854 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • bash tools for parsing arguments

    - by BCS
    I have a bash script that uses a few variables (call them $foo and $bar). Right now the script defines them at the top with hard coded values like this: foo=fooDefault bar=barDefault .... # use $foo and $bar What I want is to be able to use the script like any of these: myscript # use all defaults myscript -foo=altFoo # use default bar myscript -bar=altBar # use default foo myscript -bar=altBar -foo=altFoo An ideal solution would allow me to just list the variable that I want to check for flags for. Is there a reasonably nice way to do this? I've seen getopt and I think it might do about 70% of what I'm looking for but I'm wondering if there is a tool or indium that builds on it or the like that gets the rest.

    Read the article

  • Perl parsing ps fwaux output

    - by Magic Hat
    I am trying to figure out children processes of a given parent from ps fwaux (there may very well be a better way to do this). Basically, I have daemons running that may or may not have a child process running at any given time. In another script I want to check if there are any child processes, and if so do something. If not, error out. ps fwaux|grep will show me the tree, but I'm not exactly sure what to do with it. Any suggestions would be great.

    Read the article

  • Sax Parsing strange element with nokogiri

    - by SHUMAcupcake
    I want to sax-parse in nokogiri, but when it comes to parse xml element that have a long and crazy xml element name or a attribute on it.. then everthing goes crazy. Fore instans if I like to parse this xml file and grab all the title element, how do I do that with nokogiri-sax. <titles> <title xml:lang="sv">Arkivvetenskap</title> <title xml:lang="en">Archival science</title> </titles>

    Read the article

  • Parsing through Arabic / RTL text from left to right

    - by Dan W
    Let's say I have a string in an RTL language such as Arabic with some English chucked in: string s = "Test:?????;?????;?????;a;b" Notice there are semicolons in the string. When I use the Split command like string[] spl = s.Split(';');, then some of the strings are saved in reverse order. This is what happens: ??Test:????? ????? ????? a b The above is out of order compared to the original. Instead, I expect to get this: ?Test: ????? ????? ????? a b I'm prepared to write my own split function. However, the chars in the string also parse in reverse order, so I'm back to square one. I just want to go through each character as it's shown on the screen.

    Read the article

  • SGML Parser in Python

    - by afg102
    I am completely new to Python. I have the following code: class ExtractTitle(sgmllib.SGMLParser): def __init__(self, verbose=0): sgmllib.SGMLParser.__init__(self, verbose) self.title = self.data = None def handle_data(self, data): if self.data is not None: self.data.append(data) def start_title(self, attrs): self.data = [] def end_title(self): self.title = string.join(self.data, "") raise FoundTitle # abort parsing! which extracts the title element from SGML, however it only works for a single title. I know I have to overload the unknown_starttag and unknown_endtag in order to get all titles but I keep getting it wrong. Help me please!!!

    Read the article

  • jquery json parsing

    - by lolweb
    How do I parse this json with jQuery? DayEvents : [{"0":"886","event_id":"886","1":"5029","user_id":"5029","2":"Professional","user_type":"Professional", ...

    Read the article

  • .NET Regex - need matching string for parsing...

    - by TomTom
    Hello, I am a regex idiot and never found a good tutorial (links welcome, as well as a pointer to an interactive VS2010 integrated editor). I need to parse strings in the following form: [a/b]:c/d a, b: double with "." as possible separator. CAN be empty c: double with "." as separator d: integer, positive I.e. valid strings are: [/]:0.25/2 [-0.5/0.5]:0.05/2 [/0.1]:0.05/2 ;) Anyone can help? Thanks

    Read the article

  • fgets throwing unhandled exception while parsing stl

    - by user3478400
    I am new to c++, I am trying to parse a stl file which is of about 64MB and has about ~18K lines in it. The code works fine for first few 100 lines but then fgets throws following exception: "Unhandled exception at 0x77B0BAC5 (ntdll.dll) in STLparser.exe: 0xC0000024: There is a mismatch between the type of object required by the requested operation and the type of object that is specified in the request." I have checked manually the line for which fgets throws exception, there is nothing out of ordinary there. I am out of options for now. Any help to fix this issue will be greatly appreciated. ================CODE========================== #include<fstream> #include<iostream> #include"ParseString.h" #include"Vectors.h" using namespace std; int main(void) { //Define variables FILE *file; char *line = new char; parsestring oneline; int n_Vols = 0, n_Elms = 0, n_nods = -1, E = 0; Nod *nodes = new Nod(); Nod dummy; Elm *elements = new Elm(); int mycounter = 0; //Open file fopen_s(&file, "sample.stl", "r"); while (fgets(line, 1024, file) != NULL) //**********Getting Error Here************* { // populate required data } fclose(file); printf("%d,%d,%d", n_Vols, n_Elms, n_nods); getchar(); return 0; } ===================When broken, execution resumes at this function (not my function, something internal) void __cdecl _unlock ( int locknum ) { /* * leave the critical section. */ LeaveCriticalSection( _locktable[locknum].lock ); }

    Read the article

  • why is the address bar black in Google chrome so you cannot see what you're typing ?

    - by Tim
    The address bar background color in Google Chrome is black. I cannot see what I'm typing. What's going on? This is a problem when you're typing in a URL you've never used before (so there's no matching history). Type in a URL you've never used before. Imagine someone is giving it to you over the phone. Make a typo somewhere. Use the back arrow to go back and correct it. You cannot see where the cursor is. This just started happening yesterday. I'm on WinXP Pro.

    Read the article

  • xml parsing in php issue

    - by jan
    I have this code/function method as part of a class in php: function defaulthome(){ $fp = null; $err =''; $xml_parser = xml_parser_create(); $rss_parser = new Rssparser(); xml_set_object($xml_parser,&$rss_parser); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("http://gulfnews.com/cmlink/business-rss-feed-1.446098?localLinksEnabled=false","r"); if(!$fp) $err = "Error reading RSS data."; else { $count = 0; while ($data = fread($fp, 4096) && $count<10) { xml_parse($xml_parser, $data, feof($fp)) or $err=xml_error_string(xml_get_error_code($xml_parser)); $count++; } } fclose($fp); xml_parser_free($xml_parser); $content_sect2 = $this->tnjn->render('forms/landlords_prompt.phtml'); $context = array('content1_title'=>'Welcome to my website','content1_article'=>"test article", 'feeds'=>$err); $output = $this->tnjn->render("default.phtml", $context); return $output; } I don't get results and the error i have is empty document! Does anyone know which part of the code is the problem? Thanks very much !!

    Read the article

  • What can we do to make XML processing faster?

    - by adpd
    We work on an internal corporate system that has a web front-end as one of its interfaces. The front-end (Java + Tomcat + Apache) communicates to the back-end (proprietary system written in a COBOL-like language) through SOAP web services. As a result, we pass large XML files back and forth. We believe that this architecture has a significant impact on performance due to the large overhead of XML transportation and parsing. Unfortunately, we are stuck with this architecture. How can we make this XML set-up more efficient? Any tips or techniques are greatly appreciated.

    Read the article

  • Parsing html output and executing javascript

    - by user1841964
    I have this function: function parseScript(_source) { var source = _source; var scripts = new Array(); while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) { var s = source.indexOf("<script"); var s_e = source.indexOf(">", s); var e = source.indexOf("</script", s); var e_e = source.indexOf(">", e); scripts.push(source.substring(s_e+1, e)); source = source.substring(0, s) + source.substring(e_e+1); } for(var i=0; i<scripts.length; i++) { try { eval(scripts[i]); } catch(ex) { } } return source; } It parses and execute Javascript wonderfully except the when in <script type='text/javascript' src='scripts/gen_validatorv31.js'></script> the src file never gets executed.

    Read the article

  • Feed char array into stdin

    - by Brian Lindsey
    I am writing a parser for a mini scripting language. Some of my grammar rules require jumping to a different location in the file to obtain information. There doesn't seem to be a straightforward way to accomplish this. So, I was thinking about loading my data files into a char array array and parsing line by line. This will allow me to jump all over the array with ease. My question is, is it possible to feed char arrays (i.e. char *) into stdin, so I can easily invoke the yyparse() function as needed.

    Read the article

  • preg_match to find the current directory in a URL

    - by Ian
    I'm trying to detect the current section of a site that a user is viewing by checking for the final directory in the URL. I'm using a PHP and regex to do it and I think I'm close but unfortunately not quite there yet. Here's what I currently have: <?php $url = $_SERVER['REQUEST_URI_PATH'] = preg_replace('/\\?.*/', '', $_SERVER['REQUEST_URI']); $one = '/one/'; $two = '/three/'; $three = '/three/'; $four = '/four/'; $five = '/five/'; echo $url; if (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($one)) == $one) { // URI path starts with "/one/" echo "The section is one."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($two)) == $two) { // URI path starts with "/two/" echo "The section is two."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($three)) == $three) { // URI path starts with "/three/" echo "The section is three."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($four)) == $four) { // URI path starts with "/four/" echo "The section is four."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($five)) == $five) { // URI path starts with "/five/" echo "The section is five."; } ?> I've placed in the echo before the if statements just to get confirmation of the value of $url. This outputs /currentdirectory/file.php However the conditions themselves don't match anything and my individual echo for each section never displays. Also if there's a simpler way of doing it then I'm open to suggestions. Thanks

    Read the article

  • Parsing in groovy between two tags ?

    - by fabien-barbier
    I would like to parse this Gstring with groovy : Format type : CodeClass, Name, Accession, Count. def txt = """ <Lane_Attributes> ID,1 FovCount,600 FovCounted,598 ... </Lane_Attributes> """ And get a map like : Map = [ID:1, FovCount:600, FovCounted:598] How can I : - extract text between tag and ?, - and convert to a map ?

    Read the article

  • php parsing csv with ftell

    - by Robert82
    I have a 500mb csv file with over 500,000 lines, each with 80 fields. I am using fget to process the file line by line. $col1 = array(); while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) { $col1[] = $row[0]; } Because of an execution time limit on the PHP file by my hosting provider (120 seconds), I can't process the whole file in one run. I tried using ftell() and fseek() to remember the last position for restart. The trouble is, sometimes the ftell() position is in the middle of a row, and resuming means missing the first half of the row. Is there an elegant way to know the last line successfully processed, and resume from the one after it? I realize I can do a simple counter, and then loop through to that point again, but that would produce diminishing returns on the rows I can process towards the end of the file. Is there something like ftell() and fseek() that would work in my case? Or a way to limit ftell() to return the pointer for the end of the previous line?

    Read the article

  • Loop function works first time, not second time

    - by user1483101
    I'm creating a parsing program to look for certain strings in a a text file and count them. However, I'm having some trouble with one spot. def callbrowse(): filename = tkFileDialog.askopenfilename(filetypes = (("Text files", "*.txt"),("HTML files", ".html;*.htm"),("All files", "*.*"))) print filename try: global filex global writefile filex = open(filename, 'r') print "Success!!" print filename except: print "Failed to open file" ######This returns the correct count only the first time it is run. The next time it ######returns 0. If the browse button is clicked again, then this function returns the ######correct count again. def count_errors(error_name): count = 0 for line in filex: if error_name == "CPU > 79%": stringparse = "Utilization is above" elif error_name == "Stuck touchscreen": stringparse = "Stuck touchscreen" if re.match("(.*)" + "Utilization is above" + "(.*)",line): count = count + 1 return count Thanks for any help. I can't seem to get this to work right.

    Read the article

  • speeding up parsing of files

    - by user248237
    the following function parses a CSV file into a list of dictionaries, where each element in the list is a dictionary where the values are indexed by the header of the file (assumed to be the first line.) this function is very very slow, taking ~6 seconds for a file that's relatively small (less than 30,000 lines.) how can I speed it up? def csv2dictlist_raw(filename, delimiter='\t'): f = open(filename) header_line = f.readline().strip() header_fields = header_line.split(delimiter) dictlist = [] # convert data to list of dictionaries for line in f: values = map(tryEval, line.strip().split(delimiter)) dictline = dict(zip(header_fields, values)) dictlist.append(dictline) return (dictlist, header_fields) thanks.

    Read the article

  • Parsing groupings of strings (Python)

    - by j00niner
    I have a string that looks something like this: [["Name1","ID1","DDY1", "CALL1", "WHEN1"], ["Name2","ID2","DDY2", "CALL2", "WHEN2"],...]; This string was taking from a website. Their can be any amount of groupings. How could I parse this string and print just the Name variables of each grouping?

    Read the article

  • C++, Parsing Source

    - by pure841
    I have a webpage's source, lets say neweggs website source, and I store it inside buffer[20000]. Now, I am trying to get the three titles for the three featured products on the home page. I know I have to search, but I dont exactly know how I would go about doing it. Thanks :D

    Read the article

  • Extended URL php

    - by web.ask
    I have a problem with the extended url here in php. I'm not even sure if it's called extended url. I was wondering if someone can help me since i'm no good with PHP. I have a php page the careers.php it shows the career listing but when I click on Learn more link it goes to http(dot)localhost/houseofpatel/jobs/4/Career-4 but it outputs an "Object not found". Does xampplite have something to do with this? or is it just the codes? I also have the breadcrumb.php in here. Please see code below: session_start(); include("Breadcrumb.php"); $trail = new Breadcrumb(); $trail->add('Careers', $_SERVER['PHP_SELF'], 1); $trail -> output(); # REMOVE SPECIAL CHARACTERS $sPattern = array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'); $sReplace = array('', '-', ''); mysql_query("SET CHARACTER_SET utf8"); //$query = "SELECT * FROM careers_mst WHERE status = 1 ORDER BY dateposted DESC LIMIT 0, 4"; if(!$_GET['jobs']){ $jobsPerPage = 4; }else{ $jobsPerPage = $_GET['jobs']; } if(!$_GET['page']){ $currPage = 1; $showMoreJobs = true; }else{ $currPage = $_GET['page']; $showMoreJobs = false; } $offset = ($currPage - 1 )* $jobsPerPage; $query = "SELECT * FROM careers_mst WHERE status = 1 ORDER BY dateposted"; $process = mysql_query($query); if(@mysql_num_rows($process) > 0){ $totalRows = @mysql_num_rows($process); $query2 = "SELECT * FROM careers_mst WHERE status = 1 ORDER BY dateposted DESC LIMIT $offset, $jobsPerPage"; $process2 = mysql_query($query2); if(@mysql_num_rows($process2) > 0){ $pagNav = pageNavigator($totalRows,$jobsPerPage,$currPage,''); while($row = @mysql_fetch_array($process2)){ $id = $row[0]; $title = stripslashes($row['title']); $title1 = preg_replace($sPattern, $sReplace, $title); $description = stripslashes($row['description']); $description1 = substr($description, 0, 200); $careers_list .= ' <div class="left" style="width:340px; padding-left:10px;"> <p><span class="blue"><strong>'.$title.'</strong></span></p> '.$description1.'... <p><a href="jobs/'.$id.'/'.$title1.'" title="Learn more">[ Learn More ]</a></p> </div>'; } /*$careers_list .= ' <div class="left" style="width: 100%; margin-top:15px;"> <p><a href="more-jobs" title="More Job Opennings">MORE JOB OPENNINGS >> </a></p> <div class="divider left"></div> </div>'; */ if($showMoreJobs){ if($totalRows > $jobsPerPage){ $currPage++; } $jobNav = "<a href=careers.php?page=$currPage title='More Job Opennings'>MORE JOB OPENNINGS >> </a>"; }else{ $jobNav = "$pagNav"; } $careers_list .= "<div class='left' style='width: 100%; margin-top:15px;'> <p>$jobNav</p> <div class='divider left'></div> </div>"; } }

    Read the article

  • Nginx alias or rewrite for Horde Groupware ActiveSync URL does not process the rpc.php file

    - by Benny Li
    I'm trying to setup a Horde groupware with Nginx. The webinterface works but I do not get the ActiveSync specific URL to work. The Horde Wiki explains how to use it with an Apache Webserver here. My problem is, that I setup a rewrite (tried an alias too) to serve the location /horde/Microsoft-Server-ActiveSync via the /horde/rpc.php script. But with my current configuration nginx does the rewrite and returns a 200 status code. But it looks like that the php file is not executed. If I go to /horde/rpc.php directly it opens up the login dialog. So this seems to work correct. Firstly I was googling about the problem but could not find a working solution. So now I would like to ask you. The configuration should allow to access the ActiveSync part via the URL /horde/Microsoft-Server-ActiveSync. The horde webinterface is already accessible via /horde. My configuration looks like this: default-ssl.conf server { listen 443 ssl; ssl on; ssl_certificate /opt/nginx/conf/certs/server.crt; ssl_certificate_key /opt/nginx/conf/certs/server.key; server_name example.com; index index.html index.php; root /var/www; include sites-available/horde.conf; } horde.conf location /horde { rewrite_log on; rewrite ^/horde/Microsoft-Server-ActiveSync(.*)$ /horde/rpc.php$1 last; try_files $uri $uri/ /rampage.php?$args; location ~ \.php$ { try_files $uri =404; include sites-available/horde.fcgi-php.conf; } } horde.fcgi-php.conf include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_params (default nginx) fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; The nginx log level is set to debug. The output after the request is: 2014/06/13 10:33:15 [notice] 17332#0: *1 "^/horde/Microsoft-Server-ActiveSync(.*)$" matches "/horde/Microsoft-Server-ActiveSync", client: XX.XX.XX.XX, server: example.com, request: "GET /horde/Microsoft-Server-ActiveSync HTTP/1.1", host: "example.com" 2014/06/13 10:33:15 [notice] 17332#0: *1 rewritten data: "/horde/rpc.php", args: "", client: XX.XX.XX.XX, server: example.com, request: "GET /horde/Microsoft-Server-ActiveSync HTTP/1.1", host: "example.com" All this is happening on a RaspberryPi with Raspbian GNU/Linux 7 (which is mainly a Debian Wheezy). So I guess the rewrite works but the php file is not processed?! Does anyone know where the problem is and how to fix it?

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >