function

How to stop function once message box displayed

雨燕双飞 提交于 2021-02-10 23:19:42
问题 public void CreateFileOutput(object parameter) { TransactFileCreation(); WPFMessageBox.Show("test", "Process completed successfully."); } public void TransactFileCreation() { if (BatchFolderPath == null) { WPFMessageBox.Show("test", "Select a Batch folder"); return; } // code.. } I am calling TransactFileCreation() from CreateFileOutput(). Once Msg Box displayed, further the function should not work. But in my case, it again go to the main function and displaying msg box present in that. How

How to stop function once message box displayed

对着背影说爱祢 提交于 2021-02-10 23:18:01
问题 public void CreateFileOutput(object parameter) { TransactFileCreation(); WPFMessageBox.Show("test", "Process completed successfully."); } public void TransactFileCreation() { if (BatchFolderPath == null) { WPFMessageBox.Show("test", "Select a Batch folder"); return; } // code.. } I am calling TransactFileCreation() from CreateFileOutput(). Once Msg Box displayed, further the function should not work. But in my case, it again go to the main function and displaying msg box present in that. How

How does this recursive function get to this output?

你。 提交于 2021-02-10 22:23:47
问题 When I run this piece of code for n=5 the output I get is "5 3 1 1 3 5" I get the 5 3 1 part but after that n=-1 but when I run the code with a debugger it when n=-1 it goes to the line after numbers(n-2); i.e System.out.prt(n+ ""); even though that statement is contained in the if block. Why does this happen? public void numbers(int n) { if(n>0) { System.out.print(n+" "); numbers(n-2); System.out.print(n+" "); } } TLDR : when n=-1 System.out.prt(n+ ""); even though it is within the if block

http request function won't return result

﹥>﹥吖頭↗ 提交于 2021-02-10 20:45:37
问题 I am setting up a server with Express.js and I want a 'GET' request to '/' to return the results of a function. The function is making an get request from a news API. When I make the call to '/', the function is being triggered, and the results ('stories') is being logged in the console, but nothing is being sent in the response to the '/' 'GET' request. I have tried putting the 'return' statement in a few different places and it still doesn't work... any idea would be hugely appreciated!

Loop through dataset to calculate diveristy

心不动则不痛 提交于 2021-02-10 20:01:35
问题 I have a dataset like so: set.seed(1345) df<-data.frame(month= c(rep(1,10), rep(2, 10), rep(3, 10)), species=sample(LETTERS[1:10], 30, replace= TRUE)) I would like to loop through each month and calculate species diversity. I am aware of functions like diversity in library("vegan") , and know solutions to my question using that route (code provided below), but as an exercise for myself with loops I am trying to create a for loop or function that shows the specific calculations for Shannons

Passing one subroutine to another subroutine

≯℡__Kan透↙ 提交于 2021-02-10 19:28:16
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

江枫思渺然 提交于 2021-02-10 19:28:07
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

时光怂恿深爱的人放手 提交于 2021-02-10 19:23:06
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

Passing one subroutine to another subroutine

六月ゝ 毕业季﹏ 提交于 2021-02-10 19:21:14
问题 I have one function sub _where(\@ \&) which takes 2 arguments: the first is an array, and the second should be another function. This other function returns a boolean value, and I want to call it inside my for loop of sub _where(\@ \&) function. I am having trouble extracting the function I am passing in into a custom local name. I think I do need some local name for it, because it should be possible to pass different boolean functions to my where function. where: sub _where(\@ \&) { my @stud

How substitute variable in PowerShell SQL query

人盡茶涼 提交于 2021-02-10 18:48:47
问题 I need to use a variable in my SQL query. This is my script: function SQLQueryWriteToFile([string]$SQLquery, [string]$extractFile, [string]$facility) { #create sql connection to connect to the sql DB $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $sqlConnection.ConnectionString = "Server=blah;Database=blah_Test;User ID=blah;Password=blah" $sqlConnection.Open() #Create a SqlCommand object to define the query $sqlCmd = New-Object System.Data.SqlClient.SqlCommand $sqlCmd