Search Results

Search found 1174 results on 47 pages for 'escape'.

Page 33/47 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • more efficient way to pickle a string

    - by gatoatigrado
    The pickle module seems to use string escape characters when pickling; this becomes inefficient e.g. on numpy arrays. Consider the following z = numpy.zeros(1000, numpy.uint8) len(z.dumps()) len(cPickle.dumps(z.dumps())) The lengths are 1133 characters and 4249 characters respectively. z.dumps() reveals something like "\x00\x00" (actual zeros in string), but pickle seems to be using the string's repr() function, yielding "'\x00\x00'" (zeros being ascii zeros). i.e. ("0" in z.dumps() == False) and ("0" in cPickle.dumps(z.dumps()) == True)

    Read the article

  • Sending variables in URLs in PHP with echo

    - by alexpelan
    Hi all, I can't really find good guidelines through google searches of the proper way to escape variables in URLs. Basically I am printing out a bunch of results from a mysql query in a table and I want one of the entries in each row to be a link to that result's page. I think this is easy, that I'm just missing a apostrophe or backslash somewhere, but I can't figure it out. Here's the line that's causing the error: echo "<a href = \"movies.php/?movie_id='$row['movie_id']'\"> Who Owns It? </a> "; and this is the error I'm getting: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING If you could elaborate in your answers about general guidelines for working with echo and variables in urls, that would be great. Thanks.

    Read the article

  • Datatables pagination characters "<<" and "<" not displaying correctly in IE and Safari

    - by Jaaromy
    I'm using the DataTables jQuery plugin and am having issues with the First and Previous pagination links displaying correctly in IE and Safari (Firefox and Opera work). "<<" and "<" display as "<" and "". $(document).ready(function () { oTable = $('#fileList').dataTable({ "bJQueryUI": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "Search all columns:", "oPaginate": { "sNext": '>', "sLast": '>>', "sFirst": '<<', "sPrevious": '<' } } }); I have attempted to escape '\<\<' to no avail. Any ideas?

    Read the article

  • SQL Server uncorrelated subquery very slow

    - by brianberns
    I have a simple, uncorrelated subquery that performs very poorly on SQL Server. I'm not very experienced at reading execution plans, but it looks like the inner query is being executed once for every row in the outer query, even though the results are the same each time. What can I do to tell SQL Server to execute the inner query only once? The query looks like this: select * from Record record0_ where record0_.RecordTypeFK='c2a0ffa5-d23b-11db-9ea3-000e7f30d6a2' and ( record0_.EntityFK in ( select record1_.EntityFK from Record record1_ join RecordTextValue textvalues2_ on record1_.PK=textvalues2_.RecordFK and textvalues2_.FieldFK = '0d323c22-0ec2-11e0-a148-0018f3dde540' and (textvalues2_.Value like 'O%' escape '~') ) )

    Read the article

  • scanf formatting issue

    - by da_rockwilder
    I have a log file with the following format: INFO 2011-03-09 10:26:15,270 [user] message I want to parse the log file using PHP: // assume file exists and all that $handle = fopen("log_file.txt", "r"); while ($line_data = fscanf($handle, "%s %s %s [%s] %s\n")) { var_dump($line_data); } fclose($handle); When I run this code I get: [0]=> array(5) { [0]=> string(4) "INFO" [1]=> string(10) "2011-03-09" [2]=> string(12) "10:26:15,270" [3]=> string(5) "user]" [4]=> NULL } // snip It appears the closing bracket in the format string ("%s %s %s [%s] %s") is disrupting the rest of the line from getting parsed. I checked the PHP docs for scanf (as suggested by fscanf), and I didn't see anything mentioning having to escape a left bracket. Any suggestions on how to get the 4th and 5th elements to look like "user" and "message" respectively?

    Read the article

  • Convert ISO/Windows charsets to UTF-8 in Javascript

    - by Amir
    I'm developing a firefox plugin and i fetch web pages to do some analysis for the user. The problem is when i try to get (XMLHttpRequest) pages that are not utf-8 encoded the string i see is messed up. For example hebrew pages with windows-1125 or Chinese pages with gb2312. I already tried the following: var uDecoder=Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].getService(Components.interfaces.nsIScriptableUnicodeConverter); uDecoder.charset="windows-1255"; alert( xhr.responseText ); var decoder=Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService); alert(decoder.convertStringToUTF8(xhr.responseText,"WINDOWS-1255",true)); I also tried escape/unescape/encodeURIComponent any ideas???

    Read the article

  • How to prevent filename expansion in for loop in bash

    - by cagri
    In a for loop like this, for i in `cat *.input`; do echo "$i" done if one of the input file contains entries like *a, it will, and give the filenames ending in 'a'. Is there a simple way of preventing this filename expansion? Because of use of multiple files, globbing (set -o noglob) is not a good option. I should also be able to filter the output of cat to escape special characters, but for i in `cat *.input | sed 's/*/\\*'` ... still causes *a to expand, while for i in `cat *.input | sed 's/*/\\\\*'` ... gives me \*a (including backslash). [ I guess this is a different question though ]

    Read the article

  • byte-sized bit pattern in C and its relevance?

    - by Nikunj Banka
    I a reading Kerninghan and Ritchie's C programming language book and on page 37 it mentions byte sized bit patterns like : '\013' for vertical tab . '\007' for bell character . My doubts : What is byte sized in it and and what's a bit pattern ? What relevance does this hold and where can I apply it ? Is it in any sense related to escape sequences ? I can't seem to find any information what so ever about these byte sized bit patterns on the web . please help . thanks .

    Read the article

  • How to build a builder dynamically with escaped values

    - by dorelal
    Now I know how to build xml without escaping values. http://stackoverflow.com/questions/2693036/how-to-tell-bulider-to-not-to-escape-values However I need to build tags dynamically. Desired result <bank_info>Chase</bank_info> What I have is attr = 'bank_info' builder = Builder::XmlMarkup.new builder.attr { |x| x << 'bank_info' } # does not work I can try making the whole thing as a giant string and eval that. But evaling is not that safe. Is there a better option that I am missing.

    Read the article

  • Escaping Problem in bash using isql

    - by latz
    Hi there, I am currently working on a little backup script from some firebird databases and I've come up with a weird escaping problem that I don't seem to be able to solve. Here's the thing in my script I create a variable called sqllog in which I would like to put the output of a chain of commands, here it is. sqllog=echo "SELECT * FROM RDB\$DATABASE;" | isql -u SYSDBA -pass mypasswd localhost:mydatabase | tail -n 2 | head -n 1 | wc -l if I try to execute this in shell I get the following error Statement failed, SQLCODE = -204 Dynamic SQL Error -SQL error code = -204 -Table unknown -RDB -At line 1, column 15. Table unknown RDB means it didn't take my try to escape the $. thx for any help :)

    Read the article

  • No-argument method on window.external is invoked when checking with typeof

    - by janko
    Hi, I am trying to display an HTML page with embedded JavaScript code inside a System.Windows.Forms.WebBrowser control. The JavaScript code is expected to interact with the embedding environment through the window.external object. Before invoking a method on window.external, JavaScript is supposed to check for the existance of the method. If it is not there, the code should invoke a generic fallback method. // basic idea if (typeof(window.external.MyMethod) != 'undefined') { window.external.MyMethod(args); } else { window.external.Generic("MyMethod", args); } However, checking for a no-argument method with typeof seems to invoke the method already. That is, if MyMethod accepts any positive number of arguments, the code above will work perfectly; but, if MyMethod is a no-argument method, then the expression typeof(window.external.MyMethod) will not check for its type but invoke it, too. Is there any work-around to this behavior? Can I somehow escape the expression window.external.MyMethod to prevent the method call from occurring?

    Read the article

  • Porting C++-code from Windows to Unix: systemcalls colliding with name of functions

    - by marvin2k
    Hi I'm porting some crufty C++ Windows-code to Linux, which uses functions called "open" and "close" inside every class... Very bad style, or? Luckily that wasn't a problem in windows, since their systemcalls are named different. When I try to call the systemcalls open() or close() I'm getting some compiler error about "no matching function for call for class:open()". I can't rename all our functions named "class::open" and "class::close" in the whole code, and I have to use open() and close() since I'm working with serial ports. So my question is: How can I tell the compiler, which open I mean? How can I escape or hide the namespace of a class in C++?

    Read the article

  • Correct syntax for matching a string inside a variable against an array

    - by Jamex
    Hi, I have a variable, $var, that contains a string of characters, this is a dynamic variable that contains the values from inputs. $var could be 'abc', or $var could be 'blu', I want to match the string inside variable against an array, and return all the matches. $array = array("blue", "red", "green"); What is the correct syntax for writing the code in php, my rough code is below $match = preg_grep($var, $array); (incorrect syntax of course) I tried to put quotes and escape slashes, but so far no luck. Any suggestion? TIA

    Read the article

  • Jquery ajax call with '+' sign.

    - by 0plus1
    Hi, I'm doing this: $.ajax({ type: "POST", url: baseURL+"sys/formTipi_azioni",data:"az_tipo="+azione, beforeSend: function(){$("#form").html('<p><img src="'+baseURL+'lib/img/ajax-loader.gif" width="16" height="16" alt="loading" /><p>');}, success: function(html){$("#form").html(html);} }); there is a case when azione is TB+ the plus sign doesn't get POSTed at all, a blank space get sent. I already tried this: azione = escape(String(azione)); With no luck. Does anybody knows how to fix this? Thank you

    Read the article

  • How I Can do web programming with Lisp or Scheme?

    - by Castro
    I usually write web apps in PHP, Ruby or Perl. I am starting the study of Scheme and I want to try some web project with this language. But I can't find what is the best environment for this. I am looking for the following features: A simple way of get the request parameters (something like: get-get #key, get-post #key, get-cookie #key). Mysql access. HTML Form generators, processing, validators, etc. Helpers for filter user input data (something like htmlentities, escape variables for put in queries, etc). FLOSS. And GNU/Linux friendly. So, thanks in advance to all replies.

    Read the article

  • need to extract certain values from attribute and place them in variables

    - by user357034
    In the following markup on a page I want to extract out the following and put them in seperate variables. 1- In the onclick attribute get the value after the "ProductID" and put it in its own variable. "ProductID" So in this case it would be 318 2- In the onclick attribute get the value after the "Orig_price" and put it in a variable, "Orig_Price" So in this case it would be 22.95 3- In the onclick attribute get the value after the "width" and put it in a variable, "width" So in this case it would be 330 4- In the onclick attribute get the value after the "height" and put it in a variable, "height" So in this case it would be 300 <a href="javascript:void(0);" onclick="window.open('/BulkDiscounts.asp?ProductID=318&ProductCode=' + escape('LB30X40ES') + '&Orig_Price=22.95', 'Discounts', 'scrollbars,status,resizable,width=330,height=300');"><img src="/v/vspfiles/templates/100/images/buttons/btn_quantitydiscounts.gif" border="0" align="absmiddle"></a>

    Read the article

  • Syntax error, need help with this 'string'

    - by Camran
    I have this piece of code here below: $fq.=" + (fritidsboende_uth_from:[$fritids_uth_from TO *] AND fritidsboende_uth_to:[* TO $fritids_uth_to]) OR (fritidsboende_uth_from:'1972-01-01T01:01:00Z' AND fritidsboende_uth_to:'2019-01-01T01:01:00Z')"; I have noticed my app doesn't get anything behind the colon, in this part of the code: OR (fritidsboende_uth_from:'1972-01-01T01:01:00Z' // Notice the colon in the date string I get this error msg: Unrecognized date string: '1972-01-01T01'. Nothing from behind the colon is there though. How should I 'escape' it so that the colon is properly recognized? Its PHP... Thanks

    Read the article

  • jQuery ajax() and cakePHP urls

    - by Pickledegg
    I'm trying to call the 'tariff' action of my 'countries' controller using jQuery ajax() and pass it a country name in the following format: /countries/tariff/countryname however, with the following code ( set to GET ), it is calling this with the get '?' added: /countries/tariff/?countryname $(document).ready(function(){ $('#CountriesIndexForm select').change(function(){ $.ajax({ type: "GET", url: "/countries/tariff/", data: escape($(this).val()), success: function(html){ $(this).parent().next('div').html(html); } }); }); }); I understand its because the type: is set to GET, but is there a fix for this?

    Read the article

  • bash: How to evaluate PS1, PS2, ...?

    - by Harry
    Is there any way to 'evaluate' PS1, PS2, etc from within a bash script? Although, I can use alternate means to get all elements of my current PS1, I would really like to be able to reuse its definition instead of using these alternate means. For example, ===================================== PS1 element --> Alternate means ===================================== \u --> $USER \h --> $HOSTNAME \w --> $PWD ... ===================================== I could very well use the 'alternate means' column in my script, but I don't want to. In my PS1, I, for example, use bold blue color via terminal escape sequences which I'd like to be able to simply reuse by evaluating PS1.

    Read the article

  • Using Nokogiri to scrape groupon deal

    - by hyngyn
    I'm following the Nokogiri railscast to write a scraper for Groupon. I keep on getting the following error when I run my rb file. traveldeal_scrape.rb:10: warning: regular expression has ']' without escape: /\[0-9 \.]+/ Flamingo Conference Resort and Spa Deal of the Day | Groupon Napa / Sonoma traveldeal_scrape.rb:9:in `block in <main>': undefined local variable or method `item' for main:Object (NameError) Here is my scrape file. require 'rubygems' require 'nokogiri' require 'open-uri' url = "http://www.groupon.com/deals/ga-flamingo-conferences-resort-spa?c=all&p=0" doc = Nokogiri::HTML(open(url)) puts doc.at_css("title").text doc.css(".deal").each do |deal| title = deal.at_css("#content//a").text price = deal.at_css("#amount").text[/\[0-9\.]+/] puts "#{title} - #{price}" puts deal.at_css(".deal")[:href] end I used the exact same rubular expression as the tutorial. I am also unsure of whether or not my CSS tags are correct. Thanks!

    Read the article

  • PHP mysql_real_escape_string() returning `NULL`

    - by DavidYell
    I'm using PHP Version 5.1.6 and trying to escape a query string from my $_GET array. However my script is returning a NULL after it's escaped. It seems that mysql_escape_string() works fine, but it's deprecated, so I don't want to use it. Having checked over the phpinfo() the MySQL lib is all loaded fine from what I can see. Has anyone experienced this kind of thing before? $term = $_GET['q']; var_dump($term); // string(7) "richard" echo "<br />"; $sterm = mysql_real_escape_string($term, $db); var_dump($sterm); // NULL It's very strange to me, I can't imagine why this function wouldn't work.

    Read the article

  • Why is '\x' invalid in Python?

    - by Paul McGuire
    I was experimenting with '\' characters, using '\a\b\c...' just to enumerate for myself which characters Python interprets as control characters, and to what. Here's what I found: \a - BELL \b - BACKSPACE \f - FORMFEED \n - LINEFEED \r - RETURN \t - TAB \v - VERTICAL TAB Most of the other characters I tried, '\g', '\s', etc. just evaluate to the 2-character string of a backslash and the given character. I understand this is intentional, and makes sense to me. But '\x' is a problem. When my script reaches this source line: val = "\x" I get: ValueError: invalid \x escape What is so special about '\x'? Why is it treated differently from the other non-escaped characters?

    Read the article

  • Can't store Data URI to database without stripping + characters

    - by citizencane
    I am trying to grab a reference to images with src's in URI scheme. An example would be the images on google.com/news. if I alert(escape(saveObj.image)); I get something like below: data%3Aimage/jpeg%3Bbase64%2C/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABQAFADASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABgIDBAUHAQAI/8QAPhAAAgECBAMFBgIGCwEAAAAAAQIDBBEABRIhEzFhBkFRcYEUIjKRobFCwRUjJFKC0QcWJSZiY3Jzg7Lw4f/EABoBAAIDAQEAAAAAAAAAAAAAAAMEAAIFBgH/xAAmEQABBAEEAQMFAAAAAAAAAAABAAIDESEEEjFBBRMisVFhcZGh/9oADAMBAAIRAxEAPwAr7L5pD2gyY5JXEtLGAFY/EU2sR1U2+nXF/pZFKuffViGPW5ximQUEz1cNdPNKms6g8TlWBufDcHyxsdLUmqoYqhiWZ1BYtsSe+/ I pass that from the js file and am using django to get that into a mysql table of type utf8_unicode_ci using modelform.save, but when i examine what's in the database, I see: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABQAFADASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABgIDBAUHAQAI/8QAPhAAAgECBAMFBgIGCwEAAAAAAQIDBBEABRIhEzFhBkFRcYEUIjKRobFCwRUjJFKC0QcWJSZiY3Jzg7Lw4f/EABoBAAIDAQEAAAAAAAAAAAAAAAMEAAIFBgH/xAAmEQABBAEEAQMFAAAAAAAAAAABAAIDESEEEjFBBRMisVFhcZGh/9oADAMBAAIRAxEAPwAr7L5pD2gyY5JXEtLGAFY/EU2sR1U2 nXF/pZFKuffViGPW5ximQUEz1cNdPNKms6g8TlWBufDcHyxsdLUmqoYqhiWZ1BYtsSe The key difference is that in my database all of the '+' characters from the original have been stripped and replaced with spaces. Any ideas? I'm going blind trying to figure this out! :P

    Read the article

  • CouchDB Lucene How to URL Encode Query containing Minus (-)

    - by Peter
    I'd like to query text containing a minus (-) Sign, e.g. foo-bar with a couchdb lucene fulltext query. Following lucene rules I'd have to escape the minus, resulting in foo\-bar Last I'd have to urlencode the backslash resulting in foo%5C-bar So the complete url would be: http://127.0.0.1:5984/_fti/local/db/_design/foo/by_subject?q=foo%5C-bar Neither works. The result is always split in two phrases "q":"default:foo default:bar" Leading to documents containing only foo or bar being found also. Thanks for your help!

    Read the article

  • JQuery+Java setting field value with val() + single quote

    - by Fabio K
    I have a problem setting the value of a textarea element with jquery's val(). Basically, I have a JSP file which receives a string parameter called 'text'. Java code: String text = (String) request.getParameter('text'); Now I want my textarea element to receive this text: Javascript code: $('#textarea_id').val('<%=text%>'); It works when my text doesnt contain quotes single quotes (and possibly other chars). For example, for text = test' this error happens: Uncaught SyntaxError: Unexpected token ILLEGAL $('#textarea_id').val('test''); I hope you guys understand. I need a way to encode this value... i tried using escape so the quote is replaced by %27, but after unescaping its replaced again and the error happens. Thanks!

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >