quotes

Quotation mark incorrect when using crosstab() in PostgreSQL

前提是你 提交于 2019-12-06 02:26:44
问题 I have a table t1 as below: create table t1 ( person_id int, item_name varchar(30), item_value varchar(100) ); There are five records in this table: person_id | item_name | item_value 1 'NAME' 'john' 1 'GENDER' 'M' 1 'DOB' '1970/02/01' 1 'M_PHONE' '1234567890' 1 'ADDRESS' 'Some Addresses unknown' Now I want to use crosstab function to extract NAME , GENDER data, so I write a SQL as: select * from crosstab( 'select person_id, item_name, item_value from t1 where person_id=1 and item_name in (

Test whether the point is between matching quotes (emacs lisp)

£可爱£侵袭症+ 提交于 2019-12-06 02:10:31
How do we check whether (point) is within matching "quotes" Example 1: " (point) ", but not within Example 2: "quote here" (point) "quote there", in Emacs Lisp? What you are looking for is syntax-ppss (defined in syntax.el ). It returns 10 values, and the 4th tells you whether the point is inside a string. (eq (nth 1 (text-properties-at (point))) font-lock-string-face) This checks whether the font of the text at point is recognized as a string (i.e. has the text property face font-lock-string-face). This looking for a more elegant solution. 来源: https://stackoverflow.com/questions/15078322/test

Why JavaScript Compressors replace single quotes with double quotes?

那年仲夏 提交于 2019-12-06 02:05:36
Making some Bookmarklet, I tried to use JavaScript minifier like Google Closure Compiler or YUI Compressor . However, I didn't use these because they replace every single quotes with double quotes. I can't use a code which has double quotes, as I should enclose the code with double quotes like: <a href="javascript:alert('hello')">hello</a> So, I used MinifyJavascript for minifying. I wonder why other minifiers replace quotes. Replacing quotes doesn't minify codes. Coding style is not important for minified code. Then what is the reason for this? Pure speculation in this answer: Enforce style

JSON Encode and curly quotes

╄→гoц情女王★ 提交于 2019-12-05 22:42:06
I've run into an interesting behavior in the native PHP 5 implementation of json_encode() . Apparently when serializing an object to a json string, the encoder will null out any properties that are strings containing "curly" quotes, the kind that would potentially be copy-pasted out of MS Word documents with the auto conversion enabled. Is this an expected behavior of the function? What can I do to force these kinds of characters to covert to their basic equivalents? I've checked for character encoding mismatches between the database returning the data and the administration page the inserts

Escaping quotes from Rails Variables when using them for Javascript?

若如初见. 提交于 2019-12-05 12:16:03
问题 I am having problems when trying to use a rails variable within javascript code. For example, I might define a link_to_remote, with parameter :complete => "alert('my_var');" If my_var = "I'm testing." , then the javascript code will break due to the single quote closing the code prematurely. If I try using escape_javascript(my_var) so that the quote gets turned into \' , it doesn't seem to fix the problem. I've noticed that when you try alert('I\'m testing'); there's a problem, but if you do

MySQL choking on curly (smart) quotes

╄→尐↘猪︶ㄣ 提交于 2019-12-05 04:14:00
I'm inserting some data into a database from a form. I'm using addslashes to escape the text (have also tried mysql_real_escape_string with the same result). Regular quotes are escaped, but some other quotes are not. For example, the string: Homer's blood becomes the secret ingredient in Moe’s new beer. is converted to: Homer\'s blood becomes the secret ingredient in Moe’s new beer. I didn't think the curly quote would matter unescaped, but only this text is inserted into the database: Homer's blood becomes the secret ingredient in Moe So PHP thinks the curly quote is fine, but MySQL is losing

python's shlex alternative for C/C++ [closed]

不打扰是莪最后的温柔 提交于 2019-12-05 02:24:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 months ago . Simple question - is there something like python's shlex package that would allow me to simply parse/split/quote/escape shell-like quoted/backslashed strings in C or (possibly) C++? The shlex package is just wonderful with its purpose (giving easy births to minilanguages and stuff), having similar common

How to handle a closing parenthesis in path names in a for loop?

99封情书 提交于 2019-12-05 00:44:37
问题 I have a long path name to a program I must run in a for /f loop, which includes a closing parenthesis ")", and from which I need to parse the output: for /f "tokens=1" %%G in ('"C:\Documents and Settings\myaccount\Desktop\Test_release (x86)\program.exe" list') do (echo Will do something with %%G) ...where 'list' is a parameter passed to my program. I get the error "'C:\Documents' is not recognized as an internal or external command, operable program or batch file." I do know the problem is

How do I display randomly-chosen text with an associated image?

浪子不回头ぞ 提交于 2019-12-04 21:09:06
I'm a beginner web designer and I need to know how can I link one thing to another. The thing is that I'm making different quotes change every time the site refreshes. And I need to do the same thing with images that are located in a different div tag. The reason I need to link them is because the image needs to coordinate with the quote. For example: quote 0 with image 0. Here is the javascript code: var quotes=new Array(); quotes[0] = "text1"; quotes[1] = "Text2"; quotes[2] = "text3"; quotes[3] = "text4"; var q = quotes.length; var whichquote=Math.round(Math.random()*(q-1)); function

Regular Expression to escape double quotes inside single quotes

半腔热情 提交于 2019-12-04 20:08:11
I would need a regular expression that escapes or captures (if not already escaped) ALL the double quote characters INSIDE a single quoted string and then convert the opening single quotes to double quotes! We are refactoring files that have a lot (and i mean a lot!) of single quoted strings in either PHP and also JS files. The only thing they have in common is that the strings are at least in one line and are concated with = in both languages. I give an example ( the example is ugly legacy code so dont judge it please, i already did this :) ) We have a file that starts like this: var baseUrl