quotes

Messy &quot returned from Rails 3 controller to view

旧街凉风 提交于 2019-12-04 16:07:18
On my Rails 3 app controller I have the following code: array = [] Location.all.each{|x|array<<x.city.html_safe} @data_dump = array In the Rails console it looks nice and clean: ["Littelside", "Tessmouth"] In my view the @data_dump object gets encoded: [&quot;Littelside&quot;, &quot;Tessmouth&quot;] How do you clean this mess up? I want my object in view, to return as the object does in terminal. Thanks in advance! What about: <%=raw @data_dump %> 来源: https://stackoverflow.com/questions/6131347/messy-quot-returned-from-rails-3-controller-to-view

Triple Quotes? How do I delimit a databound Javascript string parameter in ASP.NET?

孤人 提交于 2019-12-04 14:58:36
问题 How do I delimit a Javascript data-bound string parameter in an anchor OnClick event? I have an anchor tag in an ASP.NET Repeater control. The OnClick event of the anchor contains a call to a Javascript function. The Javascript function takes a string for its input parameter. The string parameter is populated with a data-bound value from the Repeater. I need the "double quotes" for the Container.DataItem . I need the 'single quotes' for the OnClick . And I still need one more delimiter

Using YQL multi-query & XPath to parse HTML, how to escape nested quotes?

跟風遠走 提交于 2019-12-04 13:21:50
问题 The title is more complicated than it has to be, here's the problem query. SELECT * FROM query.multi WHERE queries=" SELECT * FROM html WHERE url='http://www.stumbleupon.com/url/http://www.guildwars2.com' AND xpath='//li[@class=\"listLi\"]/div[@class=\"views\"]/a/span'; SELECT * FROM xml WHERE url='http://services.digg.com/1.0/endpoint?method=story.getAll&link=http://www.guildwars2.com'; SELECT * FROM json WHERE url='http://api.tweetmeme.com/url_info.json?url=http://www.guildwars2.com';

How to store a string in a JavaScript variable that has Single Quotes and Double Quotes?

╄→гoц情女王★ 提交于 2019-12-04 12:52:44
I need to create a variable storing dynamically generated HTML content. The html content in the String returned from PHP might have single or double quotes. html_content=<?=$string;?>; The string may have double quotes like this: <span id="something">something else</span> or single quotes like this: <span id='something'>something else</span> Then, how can I correctly save the string in javascript? I can't use single quotes or double quotes. You could save that kind of string by modifying it on the server side before output, like this: html_content = "<?=addslashes($string);?>" The method

Are double “” and single '' quotes (always) interchangeable in R?

只谈情不闲聊 提交于 2019-12-04 10:23:16
问题 This is perhaps rather a minor question... but just a moment ago I was looking through some code I had written and noticed that I tend to just use ="something" and ='something_else' completely interchangeably, often in the same function. So my question is: Is there R code in which using one or other (single or double quotes) has different behaviour? Or are they totally synonymous? 回答1: > print(""hi"") Error: unexpected symbol in "print(""hi" > print("'hi'") [1] "'hi'" > print("hi") [1] "hi"

split sql statements in php on semicolons (but not inside quotes)

爷,独闯天下 提交于 2019-12-04 09:28:33
I have a system that is causing errors when users use a semicolon in a free format field. I have traced it down to a simple explode statement: $array = explode( ";", $sql ); Because this line is in a subroutine that is called from all over the system I would like to replace this line with something that will split things properly, without breaking the rest of the system. I thought I was onto a winner with str_getcsv, but that isn't sophisticated enough either. Look at the following example $sql = "BEGIN;INSERT INTO TABLE_A (a, b, c) VALUES('42', '12', '\'ab\'c; DEF');INSERT INTO TABLE_B (d, e,

character for single quote

落爺英雄遲暮 提交于 2019-12-04 07:01:11
问题 (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? 回答1: 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

How to make variables work in Single Quotes properly?

*爱你&永不变心* 提交于 2019-12-04 06:43:39
问题 I want those variables to be filled with their values, but in config.php file its writing the variable name itself, I want like $host convert to 'localhost' with single quotes in the config.php file. $handle = fopen('../config.php', 'w'); fwrite($handle, ' <?php $connection = mysql_connect({$host}, {$user}, {$pass}); ?> '); fclose($handle); 回答1: If you use variables within single quotes, they will be represented as strings instead of variables. You can also do it like this: // Get from $

Quotes in tab-delimited file

邮差的信 提交于 2019-12-04 06:40:07
问题 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

RegEx: Don't match a certain character if it's inside quotes

こ雲淡風輕ζ 提交于 2019-12-04 05:55:40
Disclosure: I have read this answer many times here on SO and I know better than to use regex to parse HTML. This question is just to broaden my knowledge with regex. Say I have this string: some text <tag link="fo>o"> other text I want to match the whole tag but if I use <[^>]+> it only matches <tag link="fo> . How can I make sure that > inside of quotes can be ignored. I can trivially write a parser with a while loop to do this, but I want to know how to do it with regex. Vasili Syrakis Regular Expression: <[^>]*?(?:(?:('|")[^'"]*?\1)[^>]*?)*> Online demo: http://regex101.com/r/yX5xS8 Full