parameters

How to check if arguments have been correctly passed to Rscript on Windows

一曲冷凌霜 提交于 2019-12-23 03:29:26
问题 I'm trying to write an R script that takes in 3 arguments when run with Rscript: input file name, whether it has a header or not (values are 'header' or 'no_header', and a positive integer (the number of replacements; its for a bootstrap application). So, when I run it this way: Rscript bootstrapWithReplacement.R survival.csv header 50 it should, before running, check if: 1) The script indeed took in 3 parameters; 2) whether the first parameter is a file; 3) whether the second parameter has a

Javascript parameters: Having many parameters with many defaults

。_饼干妹妹 提交于 2019-12-23 03:19:17
问题 I have a function with many parameters and many default value on them. function foo(p1 ,p2, p3, p4, p5, p6){ var p1 = p1 || 'default1'; var p2 = p2 || 'default2'; var p3 = p3 || 'default3'; var p4 = p4 || 'default4'; var p5 = p5 || 'default5'; var p6 = p6 || 'default6'; } How can I successfully only define like p1 and p6 only and not the rest? I know in Scala you can do foo(p1='something1',p6='something6') 回答1: You should take an object with properties for parameters. For example: function

Passing additional iteration-dependent inputs to ode45

筅森魡賤 提交于 2019-12-23 03:14:48
问题 I'm trying to solve differential equation using the ode45 function. Consider the following code, [t1,X2] = ode45(@(t,x)fun(t,x,C1,C2,C3,C4),t0,X01); where parameters C1 , C2 , C3 and C4 are column vectors, which should be available to the function that ode45 is referring to ( fun.m ). I want the values to change after every iteration, so for example, at the beginning the entry of C1 I want in is C1(1) , in the next iteration it's C1(2) , etc. How can I implement that? 回答1: You may have

Passing properties as parameters

眉间皱痕 提交于 2019-12-23 02:59:13
问题 I want to create a generalized helper method for LoadFromXML loading and validation. If the XML I'm loading from is incomplete, I do want it to fail completely without throwing an exception. Currently, my code looks like this (more or less) public override bool Load(XElement source) { return new List<Func<XElement, bool>> { i => this.LoadHelper(i.Element(User.XML_Username), ref this._username, User.Failure_Username), i => this.LoadHelper(i.Element(User.XML_Password), ref this._password, User

Object Parameters in a Constructor

自作多情 提交于 2019-12-23 02:58:15
问题 first of all I apologize if my question is difficult to understand. I'm having a hard time trying to explain exactly what I need help with. I am new to Java and the concept of passing by reference etc. Basically, I need to know why the below code is incorrect. How do I tell Java to use a method for an object passed in as a parameter of the constructor? Apologies again, and thanks for reading! public ClassOne(ClassTwo twoObject){ } public boolean OneMethod(){ twoObject.MethodName(); //

Enter a Carriage Return in a Crystal Reports Parameter Field

杀马特。学长 韩版系。学妹 提交于 2019-12-23 02:58:09
问题 I'm trying to use a parameter field as a notes box for a report, where when you run it, you can freely enter notes into the parameter and it will display as a text box on the form. However, I've found you cannot enter a Carriage Return(new line). Anyone know a way to enter a new line in a parameter for crystal? 回答1: I don't think Crystal can handle multi-line parameters. You could use multiple parameters, one for each line, or use a printable character like # as a placeholder in the text, and

Parameterize SQL Queries using R RODBC

≯℡__Kan透↙ 提交于 2019-12-23 02:43:07
问题 I have a rather simple question. On a daily basis, I perform data analysis in R using the RODBC package. I connect it to our data warehouse using SQL and move it into the R environment dbhandle <- odbcDriverConnect('driver={SQL Server};server=SQLSERVER;database=MYDATABASE;trusted_connection=true') degrees <- sqlQuery(dbhandle, "select Inst, ID, DegreeDate, Degree from DEGREE where FY = ('2015') group by Inst, ID, DegreeDate, Degree order by Inst, ID, DegreeDate, Degree", as.is=TRUE) You know

Proper usage of “this.” keyword in C#?

末鹿安然 提交于 2019-12-23 02:31:49
问题 I'm working through the book Head First C# (and it's going well so far), but I'm having a lot of trouble wrapping my head around the syntax involved with using the "this." keyword. Conceptually, I get that I'm supposed to use it to avoid having a parameter mask a field of the same name, but I'm having trouble actually tracking it through their examples (also, they don't seem to have a section dedicated to that particular keyword, they just explain it and start using it in their examples).

Slow performance in linked server query

♀尐吖头ヾ 提交于 2019-12-23 01:54:53
问题 I'm using a Linked Server Query from MSSQL to mySql . MySql table to be queried has 800K + records I'm using a temp table to pull the results from linked server and do a join on that temp table for SQL query Is there a performance difference between: Declare @MyString varchar(max), @Address varchar(20), @tempTable (Address, ColumnB, ColumnC) set @MyString = 'Select Address, ColumnB, ColumnC from schemaname.tablename where ''' + convert(varchar(30),@Address) + ''') order by ColumnB desc limit

Object orientated function parameter to alter variables

∥☆過路亽.° 提交于 2019-12-23 01:36:10
问题 I am trying convert my program to an object orientated style. Currently, I have a brandSelector() function which takes the query input and finds an intersection between the query and the brands array. However, I am trying to convert the brandSelector() to a generic Selector() or intersection finder. For example, I could call with type and the query (Selector(type, query)). In this instance you would type Selector(brand, query). That additional parameter defines which array is checked and