quotes

Bash quoted array expansion

半腔热情 提交于 2019-12-02 20:32:16
WHen I write a bash program I typically construct calls like follows: declare -a mycmd=( command.ext "arg1 with space" arg2 thing etc ) "${mycmd[@]}" || echo "Failed: foo" Where die foo is a bash function that prints Error foo and exits. But if I want to be clear about the error reason, I want to print the failed command: "${mycmd[@]}" || echo "Failed: foo: ${mycmd[*]}" So the user can run the dead command and find out why . However, quoting is lost on this pass - the Failed message arguments that have spaces or escaped characters are not printed in a way that can be cut-n-pasted and run. Does

PHP - Echoing multiple nested quotes of HTML

本小妞迷上赌 提交于 2019-12-02 19:17:24
问题 I'm attempting to echo the following line of HTML through PHP echo "<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass('$id', '$formattedDate', '$time')'></a><p class='text-center'>".$formattedDate." @ $time</p>"; I don't get an error. But the quotes for onClick='cancelClass... don't get parsed properly, which leads to the javascript function not executing. How it gets color coded in Google Chrome Source View How it should get color coded (example of another function) 回答1: Change it

strange behavior of parenthesis in python regex

时光怂恿深爱的人放手 提交于 2019-12-02 17:04:28
问题 I'm writing a python regex that looks through a text document for quoted strings (quotes of airline pilots recorded from blackboxes). I started by trying to write a regex with the following rules: Return what is between quotes. if it opens with single, only return if it closes with single. if it opens with double, only return if it closes with double. For instance I don't want to match "hi there', or 'hi there", but "hi there" and 'hi there'. I use a testing page which contains things like:

character for single quote

旧时模样 提交于 2019-12-02 14:16:07
(backtick) and ' are two different characters for single quote. I have a mysql script that shows the former two quote characters, if I change them to ', it breaks the syntax. how do I type ` from the keyboard? You are referring to the character commonly called a "backtick" ( ` ). It is not a single quote, although in some fonts it can look like one. It has a completely different meaning in MySQL than a single quote, as it is used to escape table and column names, whereas the single quote is used to enclose data values. It is at the top-left of your keyboard in all likelihood, often just to the

Remembering a quote from Alan Kay

ぐ巨炮叔叔 提交于 2019-12-02 13:48:13
Alan Kay was quoted several years ago to the effect that there had been only three new things in software in the preceding 20 years (effectively the lifespan of PCs). One of them was Spreadsheets. Does anyone remember the other two? Who is Alan Kay? (a few may ask.) His work at Xerox Parc arguably did more to shape our current software paradigm than any other influence. Alan Kay I will try to remember what I said, but none of the answers so far are correct (every one of them was done in the 60s and 70s before the commercialization of PCs in the 80s). However, we could start all over and try to

How to remove unwanted single quotes

ぃ、小莉子 提交于 2019-12-02 12:31:34
问题 I'm new to programming and I stumbled across something unsightly that I would like to remove. Here's my code: def test1(): print "What is your name, traveler?" name = raw_input() print "Hi %r!" % (name) Here's the output: What is your name traveler? Hi 'Karatepig'! Is there any way to get rid of those single quotes around my name? 回答1: You want to use %s there, not %r . print "Hi %s!" % (name) I'd add details, but I think others have already written better explanations here and here. Most

When to use single quotes, double quotes, and backticks in MySQL

非 Y 不嫁゛ 提交于 2019-12-02 11:26:26
I am trying to learn the best way to write queries. I also understand the importance of being consistent. Until now, I have randomly used single quotes, double quotes, and backticks without any real thought. Example: $query = 'INSERT INTO table (id, col1, col2) VALUES (NULL, val1, val2)'; Also, in the above example, consider that table , col1 , val1 , etc. may be variables. What is the standard for this? What do you do? I've been reading answers to similar questions on here for about 20 minutes, but it seems like there is no definitive answer to this question. Michael Berkowski Backticks are

PHP - Echoing multiple nested quotes of HTML

拈花ヽ惹草 提交于 2019-12-02 09:57:53
I'm attempting to echo the following line of HTML through PHP echo "<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass('$id', '$formattedDate', '$time')'></a><p class='text-center'>".$formattedDate." @ $time</p>"; I don't get an error. But the quotes for onClick='cancelClass... don't get parsed properly, which leads to the javascript function not executing. How it gets color coded in Google Chrome Source View How it should get color coded (example of another function) Change it to the following echo "<a class=\"fa fa-ban fa-2x cancelClass\" onClick=\"cancelClass('$id', '$formattedDate

Quotes in tab-delimited file

情到浓时终转凉″ 提交于 2019-12-02 09:46:25
I've got a simple application that opens a tab-delimited text file, and inserts that data into a database. I'm using this CSV reader to read the data: http://www.codeproject.com/KB/database/CsvReader.aspx And it is all working just fine! Now my client has added a new field to the end of the file, which is "ClaimDescription", and in some of these claim descriptions, the data has quotes in it, example: "SUMISEI MARU NO 2" - sea of Japan This seems to be causing a major headache for my app. I get an exception which looks like this: The CSV appears to be corrupt near record '1470' field '26 at

How to pass quoted parameters to another program

人走茶凉 提交于 2019-12-02 08:13:55
In a bash script, I need to pass a parameter to another program. The parameter has spaces in so must be quoted. Everything works fine in this simple case 1: /bin/echo /some/command --param="abc def ghi" Output: /some/command --param=abc def ghi The problem begins if I want to make the bash script more sophisticated, somehow the parameter value has changed in case 2 and 3: FOO="ghi" DEFAULTS="--param=\"abc def $FOO\"" /bin/echo /some/command $DEFAULTS DEFAULTS='--param="abc def '$FOO'"' /bin/echo /some/command $DEFAULTS Output: /some/command --param="abc def ghi" /some/command --param="abc def