I have a session class that basicly just sets and retrieves session variables,
the reason I made it was so I could easily change it to use sessions or something
like memcache to set the items and have them accessible on multiple pages without hitting the database
I then have this user class which uses the session object to get session v...
Is it possible to get the enum value of a base class, from a derived class, without using reflection ?
The code below using Reflection, which seems a bit of overkill to get a base class field value from an object instance.
using System;
namespace Seans
{
public class BaseClass
{
public enum eEnum{a, b, c}
}
...
From the demo below you can probably see what I am trying to do, the construct method works but the test method does not work, gives error
Fatal error: Call to a member function get() on a non-object
Can someone show me how to make something like this work?
<?PHP
//user.class.php file
class User
{
public $pic_url;
function __...
Most common method/variable/class names that you use often and that explain you intent clearly and precisely.Is there any pattern you follow to figure that out.
...
I regularly create a class that has a few private variables.
When an instance of this class is set, it should be possible to fill all variables of the class with getters and setters.
Is there an easy way to do this without having to type all these setters and getters for each variable on creation of the class?
now i have to type this f...
I'm creating a chat daemon in python and twisted framework. And I'm wondering if I have to delete every variable create in my functions to save memory in the long run when multiple users are connected, or are those variable automatically clear?. Here's a strip down version of my code to illustrate my point:
class Chat(LineOnlyReceiver...
I want to define classes in Python, but I'm currently putting them in modules, contained within packages.
Is there a cleaner way of doing this? Is it okay to define classes in __init__.py of the package itself?
I'm still learning how to arrange my Python source code, but this seems to be creating a slight ambiguity?
Thanks to all!
...
class FormatFloat(FormatFormatStr):
def __init__(self, precision=4, scale=1.):
FormatFormatStr.__init__(self, '%%1.%df'%precision)
self.precision = precision
self.scale = scale
def toval(self, x):
if x is not None:
x = x * self.scale
return x
def fromstr(self, s):
...
From my studying of python, I've found two uses for %. It can be used as what's called a modulo, meaning it will divide the value to the left of it and the value to the right of it and spit back the remainder.
The other use is a string formatter. So I can do something like 'Hi there %s' % name, where name is a list of names.
Also, if y...
I have a factory that is supposed to create objects that inherit from class Foo at run-time. I would think that System.Activator.CreateInstance's return type was the same as the type of an object it's creating, but judging from the following error message, its return type is Object.
Error 1 Cannot implicitly convert type 'object' to ...
I'm trying to loop through some static properties in a simple static class in order to populate a combo box with their values, but am having difficulties.
Here is the simple class:
public static MyStaticClass()
{
public static string property1 = "NumberOne";
public static string property2 = "NumberTwo";
public static string...
The following code
public static void main(String[] args) {
fun(new Integer(1));
}
static void fun(Object ... a) {
System.out.println(a.getClass());
}
gives the output :-
class [Ljava.lang.Object;
What class is this?
...
Hi all,
I'm sorry if my question isn't clear.
I have a class contain some properties and one of them is "Parent" which the same type of this class.
when i read data from Database i set the suitable value for each property. But how could i put the "Parent" property when i read it from database as "ParentID".
If it's not clear I'll put...
This might sound complex but i will ask anyway:
I am running a service A which uses class X. I want to start another service B which uses classes A besides new classes.
Service A is already running. I do a hot deployment of Service B.
Here is the real question - Will Service B use the same instance of class X or a separate instance....
Language by choice is AspectJ but I am open for a generic answer.
...
Hi,
I am trying to assign a theme based on browser type. I would like to do this in a base class so it would only need to be in one place (I am using a master page). I coded the following but the "OnLoad" here is performed before the "Page_PreInit". This needs to go in Page_PreInit, but why isn't it firing?
Imports Microsoft.VisualB...
Hello,
I have a small little program I am working on just for fun. It's some kind of RPG Character-Generator. My class Character has some properties (NSNumber) for strength, dexterity and so on. Also I have TextFields to display these properties on the user interface.
@interface MyController : NSObject {
Character *rpgCharacter;
IBOu...
I am creating a common class called writelog.cs
This is to store the common method to call in all my programs (aspx page)
After which, whatever error is produced, it will come out to an error log.txt
This is my codes for writelog.cs
And i got this error: The name 'Global' does not exist in the current context
/// <summary>
/// Summary ...
I am implementing a singleton class in Java to make sure no more than one instance of the class is created.
...
I have, a Starter.class which updates some classes when needed, then instantiate and runs a Client class.
Is it possible (if yes, how) for the instance of Class to know if it has been modified since the last call? The modification is only a minor one and most of the methods stay identical.
May be getting the date of last modification ...