escaping

How to escape @ in Ant SCP task

徘徊边缘 提交于 2019-12-04 05:05:26
问题 I would like to ask you for some help. How can I use an scp task when my username contains an @ sign? I tried to escape the character in many ways but it isn't working. In the following example, my username is user@host.com <scp file="test.txt" todir=""user@host.com":password@ftp.host.com:/" trust="true" sftp="true"/> <scp file="test.txt" todir="'user@host.com':password@ftp.host.com:/" trust="true" sftp="true"/> <scp file="test.txt" todir="user\@host.com:password@ftp.host.com:/" trust="true"

How can I properly escape JavaScript in JavaScript?

折月煮酒 提交于 2019-12-04 04:51:44
问题 This might be something I can't do but... parent.document.getElementById('<?php echo $_GET['song']; ?>') .innerHTML = '<img src="heart.png" onmouseover="heartOver('');" >'; The onmouseover="heartOver(''); portion breaks my JavaScript. Is there a way to escape the quotes so I can do this? 回答1: Escape nested quotes with a backslash: \' Also, never echo user data without validating or sanitizing it: $song = $_GET['song']; // Validate HTML id (http://www.w3.org/TR/REC-html40/types.html#type-name)

Ignore str.format(**foo) if key doesn't exist in foo

旧街凉风 提交于 2019-12-04 04:42:26
问题 I am trying to get an email template together. The message content will be dependent on values within a dictionary. However, the dictionary might not contain all the keys each time. This currently is fine as all values are in the dictionary ( 'Title' , 'Surname' , 'Additional Details' ): practise_dict = {"Additional Details":"blah blah blah blah", "Title": "Mr", "Surname": "Smith", "URL": "/test/tester"} msg = """From: John Smith <no-reply@somethingsomething.co.uk> To: {Title} {Surname} <blah

Shouldn't mysql_real_escape_string() leave slashes in Database?

天大地大妈咪最大 提交于 2019-12-04 04:37:30
问题 Im using smarty and mysql_real_escape_string() for user input, and when I insert some code with ' or " , and lookup in phpmyadmin it shows without backslashes. When I get record from DB i doesn't have backslashes also. But when I just pass escaped string without inserting into the db it is backslashed. Shouldn't it add slashes, insert with them and then I would strip them when i would output? Or am I missing something? 回答1: You're missing it - escaping with backslashes is meant to ensure that

Create a mapping for Vim's command-line that escapes the contents of a register before inserting it

≡放荡痞女 提交于 2019-12-04 04:36:38
Suppose that I have a document like this, and I want to search for all occurences of the URL: Vim resources: [http://example.com/search?q=vim][q] ... [q]: http://example.com/search?q=vim I don't want to type it out in full, so I'll place my cursor on the first URL, and run "uyi[ to yank it into the 'u' register. Now to search for it, I'd like to just paste the contents of that register into the search field by running: /\V<c-r>u<CR> This results in Vim searching for the string 'http:' - because the '/' character terminates the search field. I can get around the problem by running this instead:

Pyodbc query string quote escaping

一曲冷凌霜 提交于 2019-12-04 04:28:24
问题 I'm trying to execute a query using pyodbc with this kind of code cursor.execute("SELECT x from y where Name='%s'"%namepar) The parameter may have a quote and so it needs to be escaped in order to work, how do i do thos? I tried by simply replacing " ' " with " \\' " in namepar and it still doesn't work, I get a pyodbc.ProgrammingError 回答1: You can pass parameters, and that will be escaped. cursor.execute("SELECT x from y where Name = ?", (namepar,)) http://www.python.org/dev/peps/pep-0249/

Is it possible to “escape” a method name in PHP, to be able to have a method name that clashes with a reserved keyword?

a 夏天 提交于 2019-12-04 03:56:23
问题 I'm doing MVC in PHP, and i'd like to have a list() method inside my Controller, to have the URL /entity/list/parent_id, to show all the "x" that belong to that parent. However, I can't have a method called list(), since it's a PHP reserved keyword. In VB.Net, for example, if I need to have something with a name that clashes with a reserved keyword, I can wrap it in [reserved_name]. In SQL, you can do the same thing. In MySQL, you use the backtick ` Is there some syntax in PHP that specifies

Why do I need two slashes in Java Regex to find a “+” symbol?

你说的曾经没有我的故事 提交于 2019-12-04 03:53:23
Just something I don't understand the full meaning behind. I understand that I need to escape any special meaning characters if I want to find them using regex. And I also read somewhere that you need to escape the backslash in Java if it's inside a String literal. My question though is if I "escape" the backslash, doesn't it lose its meaning? So then it wouldn't be able to escape the following plus symbol? Throws an error (but shouldn't it work since that's how you escape those special characters?): replaceAll("\+\s", "")); Works: replaceAll("\\+\\s", "")); Hopefully that makes sense. I'm

How to do MySQL IN clauses using Zend DB?

半城伤御伤魂 提交于 2019-12-04 03:52:42
I'm trying to fetch rows that are in an array of integers that I have using Zend Framework 1.11. $this->dbSelect ->from($table_prefix . 'product_link') ->joinLeft($table_prefix . 'product_link_name', $table_prefix . 'product_link.product_link_name_ref_id = ' . $table_prefix . 'product_link_name.product_link_name_id') ->where('product_ref_id IN (?)', implode(', ', $product_ids)); When I use the __toString() method of $this->dbSelect , I get SELECT `phc_distrib_product_link`.*, `phc_distrib_product_link_name`.* FROM `phc_distrib_product_link` LEFT JOIN `phc_distrib_product_link_name` ON phc

symfony2 twig whitelist html tags

£可爱£侵袭症+ 提交于 2019-12-04 03:52:39
I pass a variable to my twig template in Symfony2, this variable may contain <br /> html tags, I have tried to create an extension (function), but the variable still gets escaped. How can I output a twig variable that allows the <br /> tag? Is there a simple solution to just allow a whitelist of allowed tags in certain templates? I've searched about twig sandboxes, but I'm not sure if that is my solution. edit: I still want the variable to be escaped, but to allow exclusively the <br /> tag. Jakub Zalas Initially I thought it should be possible to write custom escaper strategies so you could