I need a textbox on a WPF control that can take in text like "Commit\r\n\r" (which is the .net string "Commit\r\n\r") and convert it back to "Commit\r\n\r" as a .net string. I was hoping for a string.Unescape() and string.Escape() method pair, but it doesn't seem to exist. Am I going to have to write my own? or is there a more simple w...
I want the Escape key to close my WPF window. However if there is a control that can consume that Escape key, I don't want to close the Window. There are multiple solutions on how to close the WPF Window when ESC key is pressed. eg. http://stackoverflow.com/questions/419596/how-does-the-wpf-button-iscancel-property-work
However this sol...
i am trying to database some files on my computer with mysql in c#, its having an issue with VALUES ('drum'n'bass')
...
There are times that I automagically create small shell scripts from Python, and I want to make sure that the filename arguments do not contain non-escaped special characters. I've rolled my own solution, that I will provide as an answer, but I am almost certain I've seen such a function lost somewhere in the standard library. By “lost” ...
Here's the query:
INSERT INTO jobemails (jobid, to, subject, message, headers, datesent) VALUES ('340', '[email protected]', 'We\'ve received your request for a photo shoot called \'another\'.', 'message', 'headers', '2010-04-22 15:55:06')
The datatypes are all correct, it always fails at the subject, so it must be how I'm escaping the ...
I cannot find the answer for this question.
I read that doubling the bracket should help so something like
<node>http://test.com?test={{0}}</node>
But it didn't
...
When I write
module ApplicationHelper
def flash_helper
flash.each do |key, msg|
content_tag :div, msg, :class => key
## "<div class=\"key\">" + msg + "</div>"
end
end
end
I do not get anything unless I return the statement. The HTML is escaped in my view when I call <%= flash_helper %>. What gives? How can ...
The escape_javascript method in ActionView escapes the apostrophe ' as backslash apostrophe \', which gives errors when parsing as JSON.
For example, the message "I'm here" is valid JSON when printed as:
{"message": "I'm here"}
But, <%= escape_javascript("I'm here") %> outputs "I\'m here", resulting in invalid JSON:
{"message": "I\'...
Is there a standard C library function to escape C-strings?
For example, if I had the C string:
char example[] = "first line\nsecond line: \"inner quotes\"";
And I wanted to print
"first line\nsecond line: \"inner quotes\""
Is there a library function that will do that transformation for me? Rolling my own just seems a little sil...
I have a flash site that users can view full Screen video. the trouble is, I am making only the video player full screen (hiding the rest of the site behind it).
my "toggle full screen" button works in that it reduces the video player back to normal size when the user toggles out of full screen back.
but when the user hits the escape...
I am still not sure in that matter. While turned on we're quite safe but some other problems appear (with passing template variables or counting characters). On the other hand we have magic turned off, everything is clear, but we have to manually escape every variable (that come from untrusted source) in templates. By the way, non-magic ...
Hello!
In my form, my checkbox elements' name are onSite[].
I've made a simple JavaScript to check them with one click.
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
And in the HTML a button which calls the function.
<input type="button" name="CheckAll" value="All" onClick="checkAll(d...
Is there a command that not just echos it's argument but also escapes them if needed (e.g. if a argument contains white space or a special character)?
I'd need it in some shell magic where instead of executing a command in one script I echo the command. This output gets piped to a python script that finally executes the commands in a mo...
I receive a JSON response in an Ajax request from the server. This way it works:
{ "a" : "1", "b" : "hello 'kitty'" }
But I did not succeed in putting double quotes around kitty.
When I convert " to \x22 in the Ajax response, it is still interpreted as " by JavaScript and I cannot parse the JSON.
Should I also escape the \ and unesc...
Hi guys!
I'm having a dispute with a colleague of mine. She says that the following:
char* a = "\x000aaxz";
will/can be seen by the compiler as "\x000aa". I do not agree with her, as I think you can have a maximum number of 4 hex characters after the \x. Can you have more than 4 hex chars?
Who is right here?
...
Hi,
I have a simple PHP-based XSLT trasform code that looks like that:
$xsl = new XSLTProcessor();
$xsl->registerPHPFunctions();
$xsl->setParameter("","searchterms", $searchterms);
$xsl->importStylesheet($xslDoc);
echo $xsl->transformToXML($doc);
The code passes the variable $searchterms, which contains a string, as a parameter to th...
I am having trouble preserving an ampersand in a code example on my blog, because all HTML entities start with &.
Any tips?
For example:
<pre>
<code>
<?php
$pageTitle = str_replace('&', ' &', $page->attributes()->title);
?>
</code>
</pre>
Renders as:
<?php
$pageTitle = str_replace('&', '&', $page->attributes()->title);
?>
...
Hello,
I want to know how to echo a string that have a $ sign from a database. At this time, the value on database 'Buy one for $5.00' converts to 'Buy one for .00'.
Let's say the name of the field is title and the value is Buy one for $5.00
<?php
$body_tpl = file_get_contents('tpl.html'); //Title is: %title% blah blah %title%
$row ...
How should I go about adding slashes to only single quotes and ignoring double quotes?
I am using php. I would only like to escape single quotes to prevent my php mysql queries from breaking.
Thank you!
Edit:
I am thinking a regular expression search and replace will be the most helpful.
...
Hey actually i want to insert some sticky notes through my firefox plugin but when it comes to image pages ("http://digitalimages.bhaskar.com/dainikrajasthan//EpaperImages%5C12042010%5Cosd-large.jpg"). it contains a body element. but whenever i try to append any child than it does not insert it as html element. it escapes it first and th...