methods

How to change a label from another class? c# windows forms visual studio

*爱你&永不变心* 提交于 2019-12-31 07:16:25
问题 I know there are a lot of threads talking about this and believe me I've seen all of them, but I think I'm a little slow and cant figure out how to do this so here is the thing! I have one form public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button4_Click(object sender, EventArgs e) { adi mYadi= new adi(); adi.paso(); } private void Form1_Load(object sender, EventArgs e) { } public void l8u(string l ) { label8.Text = l; } } The l8u method is supposed

How to calculate output of Infix-Expression by using stacks in C#

白昼怎懂夜的黑 提交于 2019-12-31 05:29:12
问题 I already found different solutions on Stackoverflow, but there were some things I didn´t understand. Whats the best method to calculate the Output of e.g.: ((1+(4*(2+3)))+((2+3)*(4*5))) ? My method looks as following, but I know there are lots of mistakes in it: public static int ComputeInfix(string infix) { Stack<char> operatorstack = new Stack<char>(); Stack<int> operandstack = new Stack<int>(); for(int j = 0; j < infix.Length; j++) { char c = infix[j]; if (c => 0 && c <= 9) { operandstack

Why do you need parenthesis in Python? [duplicate]

*爱你&永不变心* 提交于 2019-12-31 05:29:09
问题 This question already has answers here : Why python need parentheses in function call? [closed] (2 answers) Closed 2 years ago . This question is just an attempt at understanding something; I know what to do, just want to know what is the difference between: datetime.datetime.now().date and datetime.datetime.now().date() 回答1: Parentheses denote that you actually want to call the method, rather than mention it for later use. On a line of its own, the latter doesn't appear to make sense, but in

Is it possible to restore a Postgres database by simply swapping out some files for speed?

好久不见. 提交于 2019-12-31 05:28:09
问题 This is a general Postgres backup and restore method question, based on the following use case for a non production server (i.e. a local testing server). I have a ~20gb database that I will mangle during the testing of a php script that will result in the need to drop it and recreate it quite often. Running dumped SQL to restore it takes quite a lot of time, and I'm on a tight deadline, so I wondered if there was a method whereby I could speed up the process. I thought the following may work:

Set Color as int value for use in setRGB(int x, int y, int rgb) method? — Java

安稳与你 提交于 2019-12-31 04:58:13
问题 Any other errors aside, I need a way of converting my Color grayScale into an int. When I plug in the Color, I get an error. setRGB method takes an x, a y, and an rgb int as parameters. How do I change my Color into an int? import java.awt.*; import java.awt.event.*; import java.util.*; import java.io.*; import javax.swing.*; import java.awt.image.*; import javax.imageio.ImageIO; public class Picture{ Container content; BufferedImage image, image2; public Picture(String filename) { File f =

Printing array error

醉酒当歌 提交于 2019-12-31 03:54:27
问题 This is probably a simple fix, but I am just not seeing it. I am trying to figure out, how do I get my printOut() method to print properly from the main Project5PartA ? Do I need get, set, and return methods? Also, is my while loop even necessary in the Tester class? The program compiles and keeps running to infinity, so I guess the while loop is wrong. But it also only prints out [Ljava.lang.String;@7c1c8c58 continuously on each line. The classes that extend the main are irrelevant and part

Python class methods changing self

[亡魂溺海] 提交于 2019-12-31 03:30:09
问题 This isn't for anything I'm working on yet, it's just some test code as I'm just learning class methods and suck. But say I have the following code class Test(int): def __init__(self,arg): self = arg def thing(self): self += 10 and going, foo=Test(12) sets foo to 12. However I want it, so when I do, foo.thing(), foo increases by 10. So far, going foo.thing() just keeps it at 12. How would I change this code to do that. 回答1: Because int is a immutable, you cannot magically turn it into a

How do I make Java wait for a method to finish before continuing?

我的未来我决定 提交于 2019-12-31 03:19:07
问题 So my problem is that I need these methods to run one after another but I cannot work out how to make the methods wait before being run. Any help is appreciated. Thank you. Here is my code: public void startMoving() throws InterruptedException { moveEnemy("right",3); wait(); moveEnemy("down",3); wait(); moveEnemy("right",2); wait(); moveEnemy("up",1); wait(); moveEnemy("right",2); wait(); moveEnemy("up",2); wait(); moveEnemy("right",2); wait(); moveEnemy("down",4); wait(); moveEnemy("left",1)

Why does my recursive method from helper not return every value?

非 Y 不嫁゛ 提交于 2019-12-30 18:39:51
问题 I want to display a tree of categories managed with the gem ancestry. I would like to use a helper which will recursively go through the tree and return the categories one by one, for the moment without html tags or content. module CategoriesHelper def display_tree(category) if category.has_children? category.children.each do |sub_category| display_tree(sub_category) puts(sub_category.name) # to check if it goes here end end category.name end end The category argument is one of the root

p method in Ruby hard to search for

隐身守侯 提交于 2019-12-30 17:16:32
问题 I'm trying to find info on the p method in Ruby. It seems to produce internal info on the properties of a class but when I try to search for it I get every word that has the letter "p" in it. 回答1: Have you seen the api doc page? http://www.ruby-doc.org/core/Kernel.html#method-i-p There's also http://apidock.com/ruby/Kernel/p 回答2: Each method you can call "directly", e.g: print, p, abort, puts, readline, etc., is located in the Kernel class. (Kernel.methods - Object.methods).sort.each do