escaping

Latex printing single slash, backslash r, backslash n

被刻印的时光 ゝ 提交于 2019-12-02 14:31:03
问题 I want the following line inside a *.tex file to be printed "as is": while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;} When I wrap it in a \verb command like this: \verb"while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;}" it doesn't work, and I get: ! Undefined control sequence. All other google answers are so complicated. Surely, there's got to be an easy way to do this, right? Thanks! EDIT: Here is the minimal counter example requested in the comments: %%%%%%%%%%%%%%%%%%%%%%%%%% % document

Escaping double Quotes in String

≯℡__Kan透↙ 提交于 2019-12-02 14:25:55
问题 How do i escape double quotes in string in Grails : string = " "12.10 On-Going Submission of ""Made Up"" Samples." " I have tried alot of methods //text : artifact.text.encodeAsJavaScript(), //text: artifact.text.encodeAsHTML(), //text: StringEscapeUtils.escapeJava((String)artifact.text), //got an error when doing this //text: artifact.text.replaceAll("\" "," \\\\" "), None of the above worked for me. You can refer to question posted by for understanding myproblem here and here too the error

How to Git stash pop specific stash in 1.8.3?

丶灬走出姿态 提交于 2019-12-02 13:52:20
I just upgraded Git. I'm on Git version 1.8.3. This morning I tried to unstash a change 1 deep in the stack. I ran git stash pop stash@{1} and got this error. fatal: ambiguous argument 'stash@1': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' I've tried about 20+ variations on this as well as using apply instead of pop with no success. What's changed? Anyone else encounter this? Bob Gilmore As pointed out previously, the curly braces may require escaping or quoting depending on your OS, shell, etc. See " stash@{1} is

Replace Double Quotes Within Attributes only in XML : C#

这一生的挚爱 提交于 2019-12-02 13:15:57
I've this string which will be part of an XML/XML Node: string a = "<Node a=\"a\"[\"\"/>"; I need only the attribute quotes to be escaped so that it becomes a= "Node a=\"a&qout;[&qout;\"/>"; I'm using C#, .NET 2.0. The link you found was correct, it just had to be adapted to C#. Here is the conversion : using System; using System.Collections.Generic; using System.Text; namespace RegEx { class Program { static void Main(string[] args) { string text = "<Node a=\"a\"[\"\" b=\"b\"[\"\"/> <Node2 a=\"a\"[\"\" b=\"b\"[\"\"/>"; string regEx = "(\\s+[\\w:.-]+\\s*=\\s*\")(([^\"]*)((\")((?!\\s+[\\w:.-]+\

Latex printing single slash, backslash r, backslash n

心已入冬 提交于 2019-12-02 12:33:10
I want the following line inside a *.tex file to be printed "as is": while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;} When I wrap it in a \verb command like this: \verb"while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;}" it doesn't work, and I get: ! Undefined control sequence. All other google answers are so complicated. Surely, there's got to be an easy way to do this, right? Thanks! EDIT: Here is the minimal counter example requested in the comments: %%%%%%%%%%%%%%%%%%%%%%%%%% % document class: beamer % %%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass{beamer} %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % no

JPA/Hibernate: Escaping HQL keywords

醉酒当歌 提交于 2019-12-02 12:22:12
This is similar to How to escape reserved words in Hibernate's HQL . But I use JPA, so the solution isn't applicable. So, how can I escape HQL keywords in JPA? Example query: ( count is the offending.) em.createQuery("INSERT INTO Count (id, count) SELECT 1, ?").setParameter(1, id).executeUpdate(); There's this jira HHH-3811 , still open. Not sure if relevant since it's about SQL keywords, not HQL keywords. You could try something like this: em.createQuery("INSERT INTO Count c (c.id, c.count) SELECT 1, ?").setParameter(1, id).executeUpdate(); That should make it clear to JPA that you mean

feof() and fscanf() stop working after scanning byte 1b as a char. Is it because it is 'ESC' in ascii? What can I do?

半腔热情 提交于 2019-12-02 12:08:29
I'm currently writing a program that processes PPM files (P6 type, not P3) The problem is that some images have the byte 0x1b which, according to the ascii table is known as 'ESC' The following is pretty much my code: // all the includes there, , , ... int main(void) { FILE *finput; int number[7]; char r, g, b; finput = fopen("my.ppm", "r"); /* The code where I read the P6 numRows numColumns 255\n ...Lets assume that part works well */ while(!feof(finput)) { num[0] = fscanf(finput, "%c", &r); // the "num[] = " part is for debugging num[1] = fscanf(finput, "%c", &g); num[2] = fscanf(finput, "%c

Mysql regex error #1139 using literal -

荒凉一梦 提交于 2019-12-02 11:48:13
问题 I tried running this query: SELECT column FROM table WHERE column REGEXP '[^A-Za-z\-\']' but this returns #1139 - Got error 'invalid character range' from regexp which seems to me like the - in the character class is not being escaped, and instead read as an invalid range. Is there some other way that it's suppose to be escaped for mysql to be the literal - ? This regex works as expected outside of mysql, https://regex101.com/r/wE8vY5/1. I came up with an alternative to that regex which is

OpenCsv reading file with escaped separator

做~自己de王妃 提交于 2019-12-02 11:45:22
Am using opencsv 2.3 and it does not appear to be dealing with escape characters as I expect. I need to be able to handle an escaped separator in a CSV file that does not use quoting characters. Sample test code: CSVReader reader = new CSVReader(new FileReader("D:/Temp/test.csv"), ',', '"', '\\'); String[] nextLine; while ((nextLine = reader.readNext()) != null) { for (String string : nextLine) { System.out.println("Field [" + string + "]."); } } and the csv file: first field,second\,field and the output: Field [first field]. Field [second]. Field [field]. Note that if I change the csv to

Can literal angle brackets be used in quoted XML attribute value strings?

旧巷老猫 提交于 2019-12-02 11:35:49
问题 For example, is this valid XML?: <foo bar="3<5" /> Or do I have to escape them?: <foo bar="3&lt;5" /> 回答1: You have to escape the literal <. You can check this using any XML Validator. 来源: https://stackoverflow.com/questions/13687998/can-literal-angle-brackets-be-used-in-quoted-xml-attribute-value-strings