parameter-passing

ggplot aes_string does not work inside a function

依然范特西╮ 提交于 2019-12-17 21:15:28
问题 Using example given on this page: ggplot inside function not working despite deparse(substitute , I tried to use aes_string but it is not working: testfn <- function(gdf, first, second, third, fourth){ print( ggplot(gdf, aes_string(first, second, color = fourth, linetype = third, group = third:fourth))+ geom_point()+ geom_line() ) } > > testfn(phil, "Level", "value","Gender","Name") Error in third:fourth : NA/NaN argument In addition: Warning messages: 1: In aes_string(first, second, color =

django form: Passing parameter from view.py to forms gives out error

天大地大妈咪最大 提交于 2019-12-17 20:35:20
问题 Newbie question: I need to accept a parameter in a form from a method in views.py but it gave me troubles. In the view I created a method with following snippet: def scan_page(request): myClient = request.user.get_profile().client form = WirelessScanForm(client = myClient) # pass parameter to the form and in the forms.py I defined the following form: class WirelessScanForm(forms.ModelForm): time = forms.DateTimeField(label="Schedule Time", widget=AdminSplitDateTime()) def __init__(self,*args,

Passing a value between components

与世无争的帅哥 提交于 2019-12-17 20:34:07
问题 I have a JDialog which calls an AsbtractAction which brings up a JFileChooser so the user can select a directory. These are all separate classes. What is the proper way of passing a value from the JFileChooser so I can display the path to the directory in the JDialog ? Edit: Updated the question. 回答1: This is an incomplete example but I guess can give you an idea of how to achieve what you need. The important bit is to reference the property where you want the selection back like YourDialog

'kubectl patch' works on Linux Bash but not in Windows Powershell ISE

随声附和 提交于 2019-12-17 20:30:38
问题 The following command works fine on Ubuntu bash: kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template": {"metadata": {"labels": {"date": "test"}}}}}' The same command does not work in Windows Powershell Console (ISE). The error is: kubectl : Error from server (BadRequest): invalid character 's' looking for beginning of object key string At line:1 char:1 + kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Passing array of integers to webapi Method

为君一笑 提交于 2019-12-17 19:44:16
问题 I am trying to pass an array of int but I can not get the value in the webapi method var postData = { "deletedIds": deletedIds }; $.ajax({ type: "DELETE", traditional: true, dataType: 'json', contentType: 'application/json', cache: false, url: "/api/Management/Models", data: JSON.stringify(postData), success: ModelDeleted, error: ModelNotDeleted }); and in apiController : [HttpDelete] public bool DeleteModel(int[] deletedIds) { return modelsRepository.DeleteModels(deletedIds); } 回答1: Your

Java: passing an argument with a different type to a function

…衆ロ難τιáo~ 提交于 2019-12-17 19:41:34
问题 In Java, suppose we have a function with the parameter double a . Does it work if I pass an integer as argument? (I mean, is there an implicit conversion?) And in the opposite case: if I have e.g. an integer as parameter, and I pass a double? Unluckily, I am not able to compile my code at the moment, and I would like to check this assert. Thank you for your attention. 回答1: See JLS - Section # 5.3 for details on Method Invocation Conversion . Method invocation contexts allow the use of one of

When would I pass const& std::string instead of std::string_view?

谁说胖子不能爱 提交于 2019-12-17 19:27:10
问题 I understand the motivation for using std::string_view; it can help avoid unecessary allocations in function arguments. For example: The following program will create a std::string from a string literal. This causes an undesired dynamic allocation, as we are only interested observing the characters. #include <iostream> void* operator new(std::size_t n) { std::cout << "[allocating " << n << " bytes]\n"; return malloc(n); } void observe_string(std::string const& str){} int main(){ observe

How to pass a parameter along with h:commandButton

ε祈祈猫儿з 提交于 2019-12-17 18:56:43
问题 One of the most common approaches to change locale in JSF+Seam - with <h:selectOneMenu> : <h:form action="#{localeSelector.select}" rendered="false"> <h:selectOneMenu value="#{localeSelector.language}" onchange="submit()"> <f:selectItem itemLabel="English" itemValue="en" /> <f:selectItem itemLabel="Francais" itemValue="fr" /> </h:selectOneMenu> </h:form> I want to implement locale changes with buttons. So, the question is - how to pass the parameter (en, fr, etc.) to update the bean with <h

how to pass a razor value to a jquery function, in an mvc view

我们两清 提交于 2019-12-17 18:28:04
问题 So I'm trying to pass a parameter to a javascript function using the razor '@' notation (in an MVC-4 View) but I'm getting Syntax error: "Unterminated string constant" Is there another way I should be writing this? @foreach (var item in Model) { ... <input type="button" value="Assign" onclick="AssignButtonClicked('@item.ID')" /> } I've used the same syntax as this answer https://stackoverflow.com/a/5179316/1662619 Edit: It's just a syntax error, the functionality still works 回答1: If you can

Why can't I pass constant arrays as arguments?

我是研究僧i 提交于 2019-12-17 16:44:39
问题 In C, why can't I do this: arrayfn({1.0, 2.0, 3.0}); if arrayfn is some function that takes in one parameter of type double[] or double* , whichever. Trying this gives me a syntax error. Is there a way that I could achieve something in C like this - generating and immediately passing an array known at compile time - that avoids having to spend a line of code pre-declaring and filling it? 回答1: Short answer: You need to make use of a compound literal. Something like arrayfn( (double[]) {1.0, 2