quotes

run from Shell R function with parameter, that contains quotes

99封情书 提交于 2019-12-11 08:16:41
问题 Suppose, I have function: my_function<-function(string) return(string) When I run it from R: >my_function('string"with"quotes') [1] "string\"with\"quotes" It works well. But when I try to run this function from Shell: R -e "source('./my_function.R'); my_function('string"with"quotes')" It fails with error, because shell can't deal with quotes. Is there any solution for this problem? P.S. I need to run this function directly from Shell. 来源: https://stackoverflow.com/questions/22225253/run-from

How to replace a string which is not in quotes

╄→尐↘猪︶ㄣ 提交于 2019-12-11 08:06:19
问题 im struggling with the following scenario, i have a multiline string which has the word test multiple times inside, the string is: Hello my name is "test" im a test test is testing i need to replace all the test -strings which are not in quotes every of the found ones should be followed by at least 1 whitespace OR a linebreak not by anything else, so the above string would transform into: Hello my name is "test" im a HELLOWORLD HELLOWORLD is testing also the test -string could be prepended by

ZF2 Remove column quotes in query

╄→гoц情女王★ 提交于 2019-12-11 06:52:05
问题 Since a while I am trying to remove the quotes of my mysql query in a ZF2 application. I need to remove the quotes to make this query works, testing the query over command line succeeded by removing the quotes around GEODIST(). $adapter = $serviceLocator->get('SphinxSearch\Db\Adapter\Adapter'); $sql = new Sql($adapter); $select = new Select; $select ->columns(array('*', 'distance' => 'GEODIST(23.3556740442177, 2.9525189115381, latitude, longitude)')) ->from('table_name') ->where(array(

When do I need quotes for document.getElementByID?

狂风中的少年 提交于 2019-12-11 05:05:35
问题 I have a simple script which converts a text input of inches into another text input of centimeters. However, when I pass it to my function, I noticed that I have to use quotes for the argument passed to document.getElementByID. I tried newheightcm without quotes and it failed. Is there a way to avoid this to maintain consistency for both arguments, i.e. both have quotes or both have no quotes? <script> function inchestocm(IDin, IDcm) { var inches = IDin.value; var centimeters = inches*2.54;

bash/ksh/scripting eval subshell quotes

 ̄綄美尐妖づ 提交于 2019-12-11 04:48:29
问题 I'm using ksh and having some trouble. Why does this code not run? [root]$ CMD="ls -ltr" [root]$ eval "W=$( $CMD )" [root]$ ksh: ls -ltr: not found. [root]$ echo $W But this works fine: [root]$ CMD="ls -ltr" [root]$ eval 'W=$('$CMD')' [root]$ echo $W 回答1: You need to escape the $(...) with a backslash to prevent it from being evaluated by the outside shell. The $(...) needs be preserved as is until it is handed off to the eval : $ CMD="ls -ltr" $ eval "W=\$( $CMD )" $ echo $W total 197092

Avoid R function paste generating backslash for quotes

坚强是说给别人听的谎言 提交于 2019-12-11 04:26:28
问题 I am trying to get two strings that contain quotations ("") combined as a character/string vector or with R function paste so I can plug the result in the argument x of writeFormula in openxlsx package. An example is like this paste('HYPERLINK("file)',':///"&path!$C$1&TRIM(MID(CELL("filename",B',sep="") and I hope that it should produce the result like this HYPERLINK("file:///"&path!$C$1&TRIM(MID(CELL("filename",B but it actually produces the result with a backslash in front of the ": [1]

Stop Eclipse from closing and opening quotes on new line inside quotes

廉价感情. 提交于 2019-12-11 04:05:24
问题 I always have my multi-line variables defined like this: var query = "\ SELECT \ this AS that \ CASE something \ FROM table \ WHERE something \ " But in Eclipse , in the default JavaScript Editor in Eclipse 3.8.0 Web Tools Platform (WTP), everytime I press return, or paste a couple of lines, Eclipse will add quotes like this: var query = "\ SELECT \ this AS that \ CASE something \ FROM table \" + " JOIN pasted.line1 \" + " JOIN pasted.line2 \" + " JOIN pasted.line3 \" + " JOIN pasted.line4 \"

Where is the lazy quoted route in Angular 2?

时光毁灭记忆、已成空白 提交于 2019-12-11 00:32:18
问题 I've watched this clarifying keynote in which Papa Misko presents the new routing system introduced in the RC version. It's contained in the presentation the solution for the "Last Lazy Loading Puzzle Piece" , and that relies on quoting the route component name as shown in his own example: {path: 'simple', component: SimpleCmp} // Non-lazy route {path: 'simple', component: 'SimpleCmp'} // Lazy route But its not working to me! The typescript compiler is complaining though. Here is the error:

Accommodate two types of quotes in a regex

北城余情 提交于 2019-12-10 19:28:10
问题 I am using a regex to replace quotes within in an input string. My data contains two 'types' of quotes - " and “ There's a very subtle difference between the two. Currently, I am explicitly mentioning both these types in my regex \"*\“* I am afraid though that in future data I may get a different 'type' of quote on which my regex may fail. How many different types of quotes exist? Is there way to normalize these to just one type so that my regex won't break for unseen data? Edit - My input

Python Dump YAML Using Double Quotes Around Strings

纵饮孤独 提交于 2019-12-10 19:25:00
问题 In Python 3.5, I have the following dictionary to be dumped into a .yaml file. D={'name': 'mydata', value: {'x': 1, 'y': 2, 'z':3}} When I run the following code: import ruamel import ruamel.yaml as yaml D={'name': 'mydata', 'value': {'x': 1, 'y': 2, 'z':3}} yaml.round_trip_dump(D, open('my_yaml.yaml', 'w'), default_flow_style=False, indent=4) The resulting my_yaml.yaml looks like the following: name: mydata value: z: 3 x: 1 y: 2 My question is, is there a handy way to write double quotes