parameter-passing

Update a variable in a TableViewController

纵然是瞬间 提交于 2019-12-13 05:01:27
问题 I need to update a variable in a TableViewController and I can't find the way to do it, can someone explain me why this is not working please? I'm getting mad. From my view controller this is the code I'm running: let storyboard = UIStoryboard(name: "Main", bundle: nil) let TV = storyboard.instantiateViewControllerWithIdentifier("tbController") as myTableViewController TV.x = "test" And then, from the TableViewController class: class myTableViewController: UITableViewController { var x:String

C passing pointer to a function confusion

心已入冬 提交于 2019-12-13 04:43:55
问题 I am a bit confused here. This is from a great C book, and maybe I question it too much, but somehow it didn't make sense. I hope I can tell my confusion. Let's say below &a points to the memory address 87 and &b points to the memory address 120; int a = 3; int b = 4; swap(&a, &b); void swap(int *px, int *py) { int temp; temp = *px; *px = *py; *py = temp; } OK, here is the question: When we call function swap and pass the parameters to the function are we actually setting "px" to 87 or are we

Pass information to new web-browser window/tab being opened with BrowserWindowOpener in Vaadin 8

不羁岁月 提交于 2019-12-13 04:33:19
问题 In Vaadin 8, we can let the user open a new tab/window within their web browser by clicking a button that has been associated with a BrowserWindowOpener. As discussed in the manual, a new UI is instantiated on our behalf. All we pass is a .class object, the class of our UI subclass to be instantiated for display in the new window/tab. For example: BrowserWindowOpener opener = new BrowserWindowOpener( PersonDetailUI.class ); That works for me. My question is: How do I pass some information to

Pass table name used in FROM to function automatically?

前提是你 提交于 2019-12-13 04:10:08
问题 Working with PostgreSQL 9.6.3. I am new to functions in databases. Let's say there are multiple tables of item numbers. Each one has the item number, the item cost and several other columns which are factored into the "additional cost". I would like to put the calculation into a function so I can call it for any of these tables. So instead of: SELECT itemnumber, itemname, base, CASE WHEN labor < 100 AND overhead < .20 THEN WHEN ..... WHEN ..... WHEN ..... ..... END AS add_cost, gpm FROM

C# passing double array to C++ dll

橙三吉。 提交于 2019-12-13 04:07:21
问题 I have an array initialized in C# code; Then I am going to pass it to C++ dll in which each single entry of the array will be re-assigned with new value. Then the array with be returned back to C# with the new value. I am wondering what is the best way to pass the array from C# to C++? (Data structure of this array in C#) What is the best way to return the array from C++? (Data structure of this array in C++) My code is not working: In C# private static double[] _statsArray = new double[4];

vb.net threading.thread addressof passing variables

落爺英雄遲暮 提交于 2019-12-13 04:05:29
问题 I am trying to pass some status from a IP call in a shared sub to a label on my form. This is the current code that i am using: Class Server <STAThread()> Public Shared Sub Main() Dim aTcpMessaging As IMessagingSystemFactory = New TcpMessagingSystemFactory() Dim anInputChannel As IInputChannel = aTcpMessaging.CreateInputChannel(theIPforLocal & ":" & thePort) Dim aStringMessagesFactory As IStringMessagesFactory = New StringMessagesFactory() Dim aStringMessageReceiver As IStringMessageReceiver

How can I pass different types of parameters (ex: array) into a functional class?

半世苍凉 提交于 2019-12-13 03:48:24
问题 I am trying to learn how to group functions by class. As an example, I tried to code a generalized least squares method to find the equation of a best-fitting line between a set of (x,y) coordinates. For my particular case, I chose a simple line y = x + 5 , so slope should be close to 1 and y-intercept should be close to 5 . Running my attempt at a coded solution below produces the error TypeError: set_x() takes 1 positional argument but 2 were given , though I am trying to pass an array of x

Cannot access class methods via generics

不打扰是莪最后的温柔 提交于 2019-12-13 03:47:26
问题 I changed my method to generic method. What is happening now is that I was deserializing the class inside the methodB and accessing its methods which I can not do anymore. <T> void methodB(Class<T> clazz) { T var; HashMap<String, T> hash = new HashMap<>(); } void methodA () { methodB(classA.class); } Initially inside methodB with no generics, var = mapper.convertValue(iter.next(), ClassA.class); var.blah() //works fine After using generics, var = mapper.convertValue(iter.next(), clazz); var

Pass Core Data Entity Attribute From ViewController A to B

空扰寡人 提交于 2019-12-13 03:01:20
问题 I have small problem with Core Data. I will skip the code because it's working fine. I just need to know what to do inside prepareForSeague method. App has 2 Views - ViewControllerA and TableViewControllerB. In TableViewControllerB I've set up table view with custom cell with cell identifier: customCell. I press button ADD and it shows Alert view with 2 rows. Alert View adds 2 Attributes to entity and these attributes are displayed in table cell. Entity is called SOMEentity while Attributes

R function contain plyr--ddply(): parameters in ddply() cannot be past correctly

你离开我真会死。 提交于 2019-12-13 02:57:02
问题 my data as follows: >df2 id calmonth product 1 101 01 apple 2 102 01 apple&nokia&htc 3 103 01 htc 4 104 01 apple&htc 5 104 02 nokia para=c('apple','htc','nokia') I wanna get the number of ids who's product contain apple&htc,apple&nokia ,etc. I make a function as follows: xandy=function(a,b){ ddply(df2,.(calmonth),summarise, csum=length(grep(paste0('apple','.*','htc'),product)), coproduct=paste0('apple','&','htc') ) } This function give me a perfect result as follows: > xandy(para[1],para[3])