« first day (53 days earlier)      last day (840 days later) » 

4:20 AM
2
Q: How to make a generic singleton base class C#

D JI am trying to create a generic singleton base class like public class SingletonBase<T> where T : class, new() { private static object lockingObject = new object(); private static T singleTonObject; protected SingletonBase() { } public static T Instance { ...

 
 
2 hours later…
6:00 AM
1
Q: Implement global application settings in C++

wmacI have a relatively big academic simulation software (50 classes). The user selects a configuration file which contains over 20 items. These constant variables are used all over the simulation platform (almost in every class). The simulation runs hundreds of thousands of agent objects a few times...

 
 
4 hours later…
9:55 AM
0
Q: Javascript singleton class default value

user2014905How can I set a default value in my singleton class. I have this dictionary in my class where the variable name "myVar" is assigned a value of 3. However, running this code below does not return a value of 3, instead it returns undefined. init = function() { var var1 = Singleton.myVar; con...

 
 
8 hours later…
5:51 PM
0
Q: dict synonym for parameter in Singleton pattern. Assignment to reserved built-in symbol warning

Super UserIn Python a way to implement the Singleton pattern is with metaclasses. class Singleton(type): def __init__(cls, name, bases, dict): super(Singleton, cls).__init__(name, bases, dict) cls.INSTANCE = None def __call__(cls, *args, **kwargs): if cls.INSTANCE is None:...

 
 
2 hours later…
7:49 PM
0
Q: Why cant the companion object extend its trait outside of the worksheet object?

Siddharth SardaWhile working through the Coursera Scala Class using Eclipse I ran into the following error. My worksheet is called Test. The following code works as expected. trait List[T] { def isEmpty : Boolean def head : T def tail : List[T] } object test { object List { def apply (x:...

 
 
2 hours later…
10:08 PM
0
Q: Javascript Modular Prototype Pattern

user1650312The problem with functional inheritance is that if you want to create many instances then it will be slow because the functions have to be declared every time. The problem with prototypal inheritance is that there is no way to truly have private variables. Is it possible to mix these two togeth...

 

« first day (53 days earlier)      last day (840 days later) »