parameter-passing

How do I use arguments of a function when using sapply?

徘徊边缘 提交于 2019-12-02 08:14:16
I have a dataset which I created by column binding using the cbindX function from the gdata package. This function allows me to bind columns with different numbers of rows. So, NA 's are introduced when there are no values in a particular column. Now, I want to calculate the standard deviation for each column. I tried using sapply(dataset,sd) This returns the standard deviation for the column having all rows with values and NA for the columns having fewer rows. I tried using the na.rm argument with the sd function: sapply(dataset,sd(na.rm=T)) and got the error message Error in is.data.frame(x)

How do you pass data/parameters to another activity in Android

那年仲夏 提交于 2019-12-02 07:51:49
How to pass data/parameter values from one activity to another in android? I have used loginname=txtloginname.getText().toString(); password=txtpassword.getText().toString(); Bundle bundle = new Bundle(); bundle.putString("loginname", loginname); bundle.putString("password", password); Intent newIntent=new Intent(); newIntent.putExtras(bundle); setResult(RESULT_OK,newIntent); finish(); But I can only get loginname value How to put both login and password key and value? ngesh You can just say newIntent.putExtra("name",value); use it multiple times to add multiple data. And depending on the data

pass parameter using system command

别来无恙 提交于 2019-12-02 07:23:07
I have an executable program that runs in several pc's in a network. At first it gets the host name (pc-001.. pc-013 etc). Then i need to mount a network drive (server1) on even pc's and (server2) on odds one based on its host name. My problem is that i use system call to run dos command 'net use' for example system ("net use x: \\\\server1\\shares /user:username pass"); How can i pass a variable to username? username is the host name which i know its value and pass is the same for all computers. You could build the command passed to system e.g. like char cmdbuf[256]; snprintf(cmdbuf, sizeof

The Correct way to pass FileUpload content into [WebMethod]?

≡放荡痞女 提交于 2019-12-02 06:56:32
I have a [WebMethod] Sendemail This works fine but now i what to upgrade it to send attachments. I am using a fileupload. This is my method Call. lblEmailSent.Text = Send.Sendemail(txtTo.Text, txtSubject.Text, txtbody.Text, FileUpload1.PostedFile.FileName, FileUpload1.FileContent); My Call Statement is underlined in blue and the two error given look like: * 1) *The best overloaded method match for 'WebTestServiceApp.localhost.Service1.Sendemail(string, string, string, string, WebTestServiceApp.localhost.Stream)' has some invalid arguments * 2) *Argument 5: cannot convert from 'System.IO.Stream

How to check if a linked list is a palindrome or not in Java?

自古美人都是妖i 提交于 2019-12-02 05:42:17
问题 I wrote a code to check if a singly linked list is a palindrome. And I made two steps: 1st. reverse the original linked list. 2nd. Check if the original and reversed linked list have the same element. public static Boolean isPalindrome(Node input){ Node reversed= reverse(input); while (input!=null){ if(input.item!=reversed.item) return false; input=input.next; reversed=reversed.next; } return true; } static Node head; public static Node reverse(Node input){ if(input==null || input.next==null)

Pascal - How to pass variable number of parameters to a subprogram ? (variadic function)

折月煮酒 提交于 2019-12-02 05:40:25
问题 I recently had to face this problem, which is, how can I pass 1, 2, 3, 9, 38919, 0 or any random number of arguments to a function or a procedure in Pascal ? I want to make a subprogram that accepts as many parameters as I want to pass it, like writeln. writeln('Hello, ', name, '.'); writeln('You were born on ', birthDate, ', and you are ', age, ' years old.'); I searched the web for some guide or whatever, but the only related threads I found were these ones, which helped me understanding my

understand passing parameters by reference with dynamic allocation

自古美人都是妖i 提交于 2019-12-02 05:30:32
I'm trying understand how to pass a parameter by reference in C language. So I wrote this code to test the behavior of parameters passing: #include <stdio.h> #include <stdlib.h> void alocar(int* n){ n = (int*) malloc( sizeof(int)); if( n == NULL ) exit(-1); *n = 12; printf("%d.\n", *n); } int main() { int* n; alocar( n ); printf("%d.\n", *n); return 0; } Here is printed: 12. 0. Example 2: #include <stdio.h> #include <stdlib.h> void alocar(int* n){ *n = 12; printf("%d.\n", *n); } int main() { int* n; n = (int*) malloc(sizeof(int)); if( n == NULL ) exit(-1); alocar( n ); printf("%d.\n", *n);

Pass parameters that contain whitespaces via shell variable

ぃ、小莉子 提交于 2019-12-02 05:29:10
I've got a program that I want to call by passing parameters from a shell variable. Throughout this question, I am going to assume that it is given by #!/bin/sh echo $# i.e. that it prints out the number of arguments that are passed to it. Let's call it count-args . I call my program like this: X="arg1 arg2" count-args $X This works quite well. But now one of my arguments has a whitespace in it and I can't find a way to escape it, e.g. the following things do not work: X="Hello\ World" X="Hello\\ World" X="'Hello World'" In all of the cases, my program count-args prints out 2 . I want to find

ssrs multivalue parameter stored procedure

落花浮王杯 提交于 2019-12-02 05:26:43
I have a report im creating in SSRS (2008) and the data for the report is coming from a stored procedure in MS SQL. I want to have a multiple value parameter (done this a million time but not with a SP) I have created the parameter based on a query, ticked the allow multiple values and modified the SP to use the IN statement (so IN (@Param)) It just wont work SQL Server profiler show this being passed @RC=N'1,2' If I choose one value, it works (returning the one value) I have seen posts about splitting joining and i've tried all these to no avail. Any ideas (surely its simple!!) Ideally id

PostgreSQL syntax error in parameterized query on “date $1”

半城伤御伤魂 提交于 2019-12-02 05:14:09
Trying to parameterize my SQL queries (using libpq function PQexecParams ), I was stuck on a syntax error: SELECT date $1 The error is: ERROR: syntax error at or near "$1" Prepared statements The explanation for this can be found in the chapter Constants of Other Types of the manual : The :: , CAST() , and function-call syntaxes can also be used to specify run-time type conversions of arbitrary expressions, as discussed in Section 4.2.9 . To avoid syntactic ambiguity, the type 'string' syntax can only be used to specify the type of a simple literal constant. Another restriction on the type