methods

c# IndexOf does not exist in current context

廉价感情. 提交于 2019-12-25 02:14:36
问题 I'm trying to use the following and can't wrap my head around why this IndexOf method isn't working. foreach (string s in regKey.GetSubKeyNames()) { RegistryKey sub = Registry.LocalMachine.OpenSubKey(string.Format(@"{0}\{1}", _UninstallKey64Bit, s), false); if (sub.ValueCount > 0) { values = sub.GetValueNames(); if (IndexOf(values, "DisplayName") != -1) { string name = (sub.GetValue("DisplayName") != null) ? sub.GetValue("DisplayName").ToString() : string.Empty; if (!string.IsNullOrEmpty(name

Tic Tac Toe Program Loop Problems

无人久伴 提交于 2019-12-25 02:01:44
问题 EDIT: I've noticed that my program outputs "Invalid move" when you put in an incorrect number for the TicTacToe table. What would cause this? I only use my move(row, col) method once so it shouldn't repeat Invalid Input twice. I've been constructing a Tic Tac Toe program and I'm 99.9% done I believe. There is one pesky loop that I cannot figure out, and I've been adding things for a while to try and fix it. I think it's just a small dumb mistake I can't seem to notice by myself. Anyway the

NSDate as argument in customMethod

不想你离开。 提交于 2019-12-25 01:59:45
问题 I've defined my custom method ( -(void)loadXML {} ) into my appDelegate. Now I'd like to use it in severals viewControllers; Right now I'm using local NSDate objects. NSDate *todayDate = [NSDate date]; NSString *XMLUrl = @"http://localhost/MyApp/GetXML?&aDate="; NSString *urlString = [NSString stringWithFormat:@"%@%@", XMLUrl, todayDate]; tbxml = [[TBXML alloc] initWithURL:[NSURL URLWithString:urlString]]; instead of 'todayDate' I'd like to have 'selectedDate'; also how I add a bool to my

Data is being retrieved as project.model not as elements in swift ios

怎甘沉沦 提交于 2019-12-25 01:44:51
问题 I am trying to retrieve the data elements from DataTable in SQLite database but when I retrieve the data I am getting the data as myproject.mymodelclass where WidgetData is my model class and myproject is the the name of my project on which I am working here is the snapshot of console [MyProject.WidgetData, MyProject.WidgetData, MyProject.WidgetData, MyProject.WidgetData] But I want all the elements of DataTable should be printed in ViewController class. WidgetData Class import Foundation

Tidying up code for simple Java program

一个人想着一个人 提交于 2019-12-25 01:43:50
问题 I have the following program and it's working as I had hoped but now I would like to tidy up the code, putting bits into new methods, so I'm not left with loads of code in the main method. I'm new to Java, so don't know how to go about this. I have the following methods: public String getInventoryCode() { return inventoryCode; } public int getQuantityInStock() { return quantityInStock; } public int getDailyDemand() { return dailyDemand; } public int getReOrder() { return reOrder; } public int

Java : logging execution history as XML

徘徊边缘 提交于 2019-12-25 01:36:50
问题 For debugging purposes, I need to follow the execution of some piece of code, within a class. I would like to generate a log for all method calls, in XML, like : <call class='pack.age.MyClass' method='myMethod1'> <param name='param1'>param1.toString() value</param> ... <call>Call to other method within myMethod1; you get the idea</call> </call> Because the class is long and has lots of methods, I wondered if there is a way to access the parameters generically, maybe using reflection. I am

Changing variable values after method

这一生的挚爱 提交于 2019-12-25 01:32:28
问题 thank you for helping with multiple coding issues in the past but I've stumbled onto one more. I really need some directions on this. In the script below, I am trying to change the value of b when met1, met2 and met3 are called in the Main function. class Class3 { public class Storage { public static int a = 100; public static int b = a + 5; } public static void Main() { Methods Test = new Methods(); Console.WriteLine("Original a value: {0}", Storage.a); Console.WriteLine("b value: {0}",

Declaring And Calling Methods in Blue Prism Global Code Stage

孤街浪徒 提交于 2019-12-25 00:56:16
问题 I am a Blue Prism RPA Developer and I want to create methods in my global code and call them from other code stages. In Global code info page, it is stated that this could be done but i could not find a satisfactory resource on the subject. Can anyone share a syntax rule set, maybe a sample global code and code stage code sniplets or guide me in the direction? I use C# and i would much appreciate responses in C# Note: I am not from a developer background, i have elementary coding know how but

Why does this Type Assertion on a direct implemented interface fail?

為{幸葍}努か 提交于 2019-12-25 00:53:09
问题 I am struggling with Go's Type Assertion mechanism. In the below example the Type Assertion for Qux.(Bar) fails. Why does a direct implementation of DoBar() at Qux not fullfill the Bar interface? package main import ( "fmt" ) type Nameable interface { Name() string } type Foo interface { Nameable DoFoo() string } type Bar interface { Nameable DoBar() string } type bar struct { name string } func (b bar) Name() string { return b.name } // Qux embeds bar and is expected to fullfill Nameable

Passing Parameters to the print method (JAVA)

谁说我不能喝 提交于 2019-12-25 00:20:30
问题 I need some help with my code. What i need it to do is everytime a page is added to the Java Book different data needs to be on the page every time. I've tried it a number of different ways and i just can't work it out! Here's my code: dataBase data = new dataBase(); int userCountAmount = data.getAmountOfUsers(); Book bk = new Book(); PrinterJob PJ = PrinterJob.getPrinterJob(); String[] pupilName = new String[userCountAmount]; String[] parentsName = new String[userCountAmount]; int parCount =