methods

.NET ParameterizedThreadStart wrong return type

Hello, I just started experimenting with Threads and I ran in to a problem I'm not able to solve on my own. I get the error: Error 1 'bool projekt.ftp.UploadFil (object)' has the wrong return type I use this code to start a thread using the method ftp.Uploadfile: Thread ftpUploadFile = new Thread(new ParameterizedThreadStart(ftp.Upl...

Overloading of Math.sqrt : overloading method seems to hide the original one

Hello, trying to overload the java.lang.Math.sqrt static method for int type : import static java.lang.Math.sqrt; class Test { private static double sqrt(int n) { return sqrt(1.0 * n); } public static void main(String[] args) { System.out.println(sqrt(1)); } } an odd error arises : Test.java...

iPhone: Warning in Cyclic import in MKAnnotation: method not found

I just resolved a cyclic dependency problem by using class forwarding. Now, I am getting a warning of no 'showSumDetails' method found. I don't understand why it should happen at all, any help will be appreciated. Including a bit of code here: MyAnnotation.h #import <Foundation/Foundation.h> #import <MapKit/MapKit.h> //#import "MyMapVi...

Method causing a weird crash

I am building this app and i am encountering some issues I havent seen before. the app crashes when I run the method below which is connected to a uibutton for a trigger. so when I hit the button it does the print and then the simulator crashes to the springboard. if I launch the app again from the springboard it doesn't get to the pri...

Calling a method in a Javascript Constructor and Accessing Its Variables

I am trying to call a method from the constructor of my javascript constructor, is this possible and if so, I can't seem to get it working, any insight would be great! Thanks! function ValidateFields(pFormID){ var aForm = document.getElementById(pFormID); this.errArray = new Array();//error tracker this.CreateErrorList(); } ...

How do you access an instance variable within a mixin method?

Hi, How do you access an instance variable within a mixin method? I can think of 2 ways, but both seem problematic. Have the mixin method access the instance variable directly as any class method would, e.g self.text. Problem with this is that it places restrictions on where the mixin method can be used, and forces the class doing the ...

[How-to] Call back a function in the original class

Hey guys, I found some useful information on the web but I still can't manage to do it by myself ;) Ok, let me put my problem in context for you : I have a first class (myViewController) whose declaration is below : // i just give you relevant information RssParser *rssParser; UIActivityIndicator *activityIndicator; In my viewDidL...

NerdDinner tutorial - missing explanation for Helper methods?

I've started reading NerdDinner tutorial from scratch. While reading and coding application I came to part about some Helper methods and there was one example of some class (AddRuleViolations) but there was no any explanation WHERE to add this class. So I skipped this one and continued with tutorial without using this class later in code...

Calling temporary object’s methods gives compiler error with older c library.

Hi everybody! I have a strange problem with my code when porting from a computer with glibc-2.5-25 (suse 10.2) to a computer with glibc-2.3.2-6 (suse 8.2). I use several method calls on temporary objects and they are not working on the older machine. class A { public: A(int n) {} void method() {} }; int main() { A(10).meth...

Where would I run this validateForm method? I'm a very newbie PHP developer getting the hang of web developing.

Here's what I have: <html> <head> <?php $validForm = false; function getValue($field){ if(isset($_GET[$field])){ return $_GET[$field]; } else{ return ""; } } function validateForm(){ //magic goes here. } ?> </head> <body> <?php if(...

Calling the overriden method from the base class in C#

Given the following C# class definitions and code: public class BaseClass { public virtual void MyMethod() { ...do something... } } public class A : BaseClass { public override void MyMethod() { ...do something different... } } public class B : BaseClass { public override void MyMethod() ...

PHP class function will not change an array

I am new to PHP and programming in general. I have been working on a few things with PHP that have required me to create classes, which has been fine, except that I can't seem to get my class methods to work on arrays that are properties of the class. I must be doing something pretty fundamentally wrong, because it doesn't seem to work r...

Need help returning object in thread run method

I have a Java class that extends Thread, it basically looks like the following: public class HttpRequestDispatcher extends Thread { private String url; private String method; // GET or POST private byte[] postData; public HttpRequestDispatcher(String url, String method, byte[] postData) { this.url = url; ...

Method Chains PHP OOP

Hello, After seeing another question just started, I wanted to ask as to how something is actually achieved. When I use some frameworks they do this like $object->select('something') ->from('table') ->where( new Object_Evaluate('x') ) ->limit(1) ->order('x'); How do you actually do this kinds of chains...

% string formatting doesn't work in class methods? (ruby)

any idea how I can display headers using % for formatting? I does nothing in class method but works nicely in instance method class Stats attr_accessor :type, :count; def initialize type @type = type @count = 0 end def self.display "%s %4s " % ["header1",'header2'] #puts 'headers' ObjectSpace.each_object(Stats) { |...

How to quickly determine if a method is overridden in Java

There is a possible optimization I could apply to one of my methods, if I can determine that another method in the same class is not overridden. It is only a slight optimization, so reflection is out of the question. Should I just make a protected method that returns whether or not the method in question is overridden, such that a subcla...

Calling a custom method from a datagridview column expression

Howdy using c#, vs2008 winforms I have a datagridview that i am programtically binding to a binding source, that is bound to a dataset with 1 table. After filling the dataset using the sqlAdaptor, i want to add a new column to the dataset, and in the new column populate it with a result derived from a call to a custom method in the fo...

Python: Determine if method was overridden.

Hey there, ran into the following. Dont need it clarified but find it interesting, though. Consider: >>> class A: ... def __str__(self): ... return "some A()" ... >>> class B(A): ... def __str__(self): ... return "some B()" ... >>> print A() some A() >>> print B() some B() >>> A.__str__ == B.__str__ Fal...

C# Set specific culture for class

I have a class in C# which has various methods. I want to use en-US culture in all the methods in this class. Can I set the culture for a specific class? Background: I have a List<object> and some of the object's are numbers and some are strings. I would like all the numbers written using US culture, but I don't know which items are nu...

From where to start a timer for a database polling?

I'm trying to understand a general flow of WPF application, it's not everything clear for me, so, please, help me to understand the following: If I want my database polling Timer in a WPF application was started not from a code behind file of my main window, but from another separate class, how I should implement this? Should this clas...