parameter-passing

ggplot does not work in function, passing in variable names as strings

我的梦境 提交于 2019-12-23 10:00:01
问题 I have following simple function but its ggplot command does not work. The command works all right when given from command line: > testfn <- function(gdf, first, second){ library(ggplot2) print(ggplot(gdf, aes(first, second)) + geom_point()) } > > testfn(mydataf, vnum1, vnum2) Error in eval(expr, envir, enclos) : object 'second' not found > > ggplot(mydataf, aes(vnum1, vnum2)) + geom_point() > (plots graph without any error) I tried to use aes_string instead of aes ; and also using x=first, y

Cost of using params in C#

一个人想着一个人 提交于 2019-12-23 07:19:04
问题 Does anyone have advice for using the params in C# for method argument passing. I'm contemplating making overloads for the first 6 arguments and then a 7th using the params feature. My reasoning is to avoid the extra array allocation the params feature require. This is for some high performant utility methods. Any advice? Is it a waste of code to create all the overloads? 回答1: Honestly, I'm a little bothered by everyone shouting "premature optimization!" Here's why. What you say makes perfect

Bing GeocodeService userState usage as custom additional parameter

守給你的承諾、 提交于 2019-12-23 05:55:07
问题 In my Windows Phone 7.1 application I have to send a request that consumes Bing geocoding services (using the address: http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc/mex, without setting the option Always generate message contracts in my Service Reference Settings). My request is made in this way: BingMapGeoCodeService.GeocodeRequest request = new BingMapGeoCodeService.GeocodeRequest(); request.Options = new BingMapGeoCodeService.GeocodeOptions() { Filters = new

Pass by Value in Java

大憨熊 提交于 2019-12-23 05:46:15
问题 import java.util.Arrays; public class Test { public static void main(String... args) { String[] strings = new String[] { "foo", "bar" }; changeReference(strings); System.out.println(Arrays.toString(strings)); // still [foo, bar] changeValue(strings); System.out.println(Arrays.toString(strings)); // [foo, foo] } public static void changeReference(String[] strings) { strings = new String[] { "foo", "foo" }; } public static void changeValue(String[] strings) { strings[1] = "foo"; } } Can anyone

How to make runuser correctly forward all command line arguments, instead of trying to interpret them?

浪子不回头ぞ 提交于 2019-12-23 05:43:14
问题 I got this simple script: #!/bin/bash SOURCE_USER=$USER DESTINE_USER=$1 id -u $SOURCE_USER > /dev/null 2>&1 if [ "$?" == "1" ] || [ -z $SOURCE_USER ] then printf "Error: Invalid source user '$SOURCE_USER'\\n" exit 1 fi if [ -z $DESTINE_USER ] then printf "Error: Invalid destine user '$DESTINE_USER'\\n" exit 1 fi SOURCE_GROUPS=$(id -Gn ${SOURCE_USER} | sed "s/${SOURCE_USER} //g" | sed "s/ ${SOURCE_USER}//g" | sed "s/ /,/g") SOURCE_SHELL=$(awk -F : -v name=${SOURCE_USER} '(name == $1) { print

Passing and returning value from javascript to android

佐手、 提交于 2019-12-23 04:21:01
问题 Dear all i am just passing and returrn some value from javascript and android. I could able to pass value javascript to android. My problem is i could not able to return the value again. This is my snippet. can any body help me out HTML and Script <html> <head> <script src="phonegap-1.3.0.js" type="text/javascript"></script> <script type="text/javascript"> function invoke(param1,param2) { alert('Hai'); //invoking the JavascriptBridge registered under the 'jb' namespace var result = jb.callMe

jsf 2 method parameters action listener

白昼怎懂夜的黑 提交于 2019-12-23 04:13:20
问题 Is there a way to pass a variable into a method param: <h:commandButton value="Add to Order" actionListener="#{orderBasket.addItems(currentItem.id)}"/> This always seems to pass 0 into the method for some reason. 回答1: That's only possible when you use action instead of actionListener <h:commandButton value="Add to Order" action="#{orderBasket.addItems(currentItem.id)}"/> and you're running a Servlet 3.0 / EL 2.2 capable container (Tomcat 7, Glassfish 3, JBoss 6, etc) and your web.xml is

Use a variable in PowerShell to pass multiple arguments to an external program

喜欢而已 提交于 2019-12-23 04:05:24
问题 I downloaded the npm package for merge junit reports - https://www.npmjs.com/package/junit-merge. The problem is that I have multiple files to merge and I am trying to use string variable to hold file names to merge. When I write the script myslef like: junit-merge a.xml b.xml c.xml This works, the merged file is being created, but when I do it like $command = "a.xml b.xml c.xml" junit-merge $command This does not work. The error is Error: File not found Has anyone faced similar issues? 回答1:

Unable to edit with bcdedit filelds in powershell - cmd.exe command line fails

泪湿孤枕 提交于 2019-12-23 03:19:30
问题 Why can't I edit the description field using bcdedit in PowerShell? For example, in cmd.exe the following command: bcdedit /set {GUID} description "OS2" completes successfully, changing the description field for the specified GUID, but when I do the same thing from Powershell, I get the following error: The set command specified is not valid. Run "bcdedit /?" for command line assistance. The parameter is incorrect. Can someone explain this to me? 回答1: To pass a value enclosed in {...} as a

Pass value from one view to other laravel routes configuration

丶灬走出姿态 提交于 2019-12-23 03:12:42
问题 I have just started using laravel and currently using the version 5.2. I am using two forms to get the data. First form in first view and second form in second view. I need to figure out a way to tell the second form, the form id of the first one, which the second form will be linked to. I know this can be done by passing the values using the URL. But I lack the knowledge of the correct syntax. 1- How to send data while redirecting? 2- How should the route look like? 3- How to access that