The Java Tutorials say: "it is not possible for two invocations of synchronized methods on the same object to interleave."
What does this mean for a static method? Since a static method has no associated object, will the synchronized keyword lock on the class, instead of the object?
...
I am creating an interface for Python scripting.
Later I will be dong Python scripting also for automated testing.
Is it necessary the at i must use class in my code.Now I have created the code
with dictionaries,lists,functions,global and local variables.
Is class necessary?
Help me in this.
...
there is a check I need to perform after each subsequent step in a function, so I wanted to define that step as a function within a function.
>>> def gs(a,b):
... def ry():
... if a==b:
... return a
...
... ry()
...
... a += 1
... ry()
...
... b*=2
... ry()
...
>>> gs(1,2) # should return 2
>>> gs(1,1) # should re...
I've got a piece of code which contains a for loop to draw things from an XML file;
for evoNode in node.getElementsByTagName('evolution'):
evoName = getText(evoNode.getElementsByTagName( "type")[0].childNodes)
evoId = getText(evoNode.getElementsByTagName( "typeid")[0].childNodes)
evoLevel = get...
The general rule is that I want to say, "T has a method with a String parameter which will return List." Put verbosely, we might call the interface ICanCreateListOfObjectsFromString. A possible application might be search.
It feels like it'd be nice to have a static method in my interface, but I know that's not allowed in C#. What is...
Hi, I have a question.
What does it mean to call a class like this:
class Example
{
public:
Example(void);
~Example(void);
}
int main(void)
{
Example ex(); // <<<<<< what is it called to call it like this?
return(0);
}
Like it appears that it isn't calling the default constructor in that case. Can someone give a reason why ...
which is better ???
public class Order
{
private double _price;
private double _quantity;
public double TotalCash
{
get
{
return _price * _quantity;
}
}
or
public class Order
{
private double _totalCash;
private double _price;
private double _quantity;
private void CalcCashTotal()
{
_tot...
I'm having a little trouble getting my head around the conceptual difference between an object and a class. I don't really understand the distinction between the two in any programming language, but currently I'm working with Perl, and Moose, so I'd prefer an explanation using those things.
Cheers
...
I have the need to take a string argument and create a class in python. In Java, I would use Class.forName().newInstance(). Is there an equivalent in python?
Thanks for the responses. To answer those who want to know what I'm doing: I want to use a command line argument as the class name, and instantiate it. I'm actually programmi...
I have build myself a generic collection class which is defined like this.
public class StatisticItemHits<T>{...}
This class can be used with int and string values only. However this
public class StatisticItemHits<T> where T : string, int {...}
Won't compile. what am I doing wrong?
...
I compiled a MATLAB class to .NET, but instead of having my proper constuctor and methods in my class
classdef Foo
properties
p1
p2
end
methods
function bar
...
I have these functions in the .NET assembly:
~Algo()
public Algo()
public void Foo(int numArgsOut, ref MathWorks.MATLAB.NET.Arrays.MWArray[] argsOut, Mat...
I have a Python class full of static methods. What are the advantages and disadvantages of packaging these in a class rather than raw functions?
...
This came up in a conversation I was having online, and it occured to me that I have no idea how this is supposed to work: Quite a lot of programmers seem to just take as a given- indeed, obvious that classes are a necessary language feature for managing huge software projects.
It's not obvious to me how they do this.
My question to yo...
I'm looking for a way to write a custom .net class that would allow for nested methods.
For example... say I have a class X with a function Y that returns a list. Then I have another function that returns a sorted list...
I would like to be able to do something like x.y().z() where z would accept the output of y() as its input.
Basic...
I am not sure where the best place to put validation (using the Enterprise Library Validation Block) is? Should it be on the class or on the interface?
Things that may effect it
Validation rules would not be changed in classes which inherit from the interface.
Validation rules would not be changed in classes which inherit from the cl...
Earlier I asked why this is considered bad:
class Example
{
public:
Example(void);
~Example(void);
void f() {}
}
int main(void)
{
Example ex(); // <<<<<< what is it called to call it like this?
return(0);
}
Now, I understand that it's creating a function prototype instead that returns a type Example. I still don't get why ...
A customer requires a preview of a new feature of our product. They asked to have that feature sent to them in a jar file (like a patch). There's no problem with including the new classes in said jar file. However, an existing class was modified, which is needed to integrate the new feature. They just want to add this new jar file withou...
I found a way to extend classes in VBScript, but are there any ways to pass in parameters or overload the constructor? I am currently using an Init function to initialize the properties, but would like to be able to do this when I create the object.
This is my sample class:
Class Test
Private strText
Public Property Get Text
...
I have 2 classes, a parent and a child.
Class Test
Private Test_Text
Private Sub Class_Initialize()
Test_Text = "Hello"
End Sub
Private Sub Class_Terminate()
End Sub
Public Property Get Text
Text = Test_Text
End Property
Public Property Let Text(ByVal strIn)
Test_Text = strI...
I'm adapting a pretty basic js function into a class. Anyway, basically it just creates a floating container
above the main page. I'm aware it's incomplete, but I'm in the middle of typing it up, and keep getting caught out when attempting to call the close() function. Firefox returns a this.sdiv is undefined. I'm confused as to how thi...