I was plugging away on an open source project this past weekend when I ran into a bit of code that confused me to look up the usage in the C# specification.
The code in questions is as follows:
internal static class SomeStaticClass
{
private const int CommonlyUsedValue = 42;
internal static string UseCommonlyUsedValue(...)
...
Dears,
I had a problem.
I´m using the php script calle SocialEngine and I´d like to use nginx to cache the static content.
I have 2 otpions
1) Cache some dirs like /images/ , /templates/ , /include/css/ , /include/js/... etc
2) Caache some static files like: .css, .tpl, .js, .gif, etc...
I prefer use the first option, but the second...
Hello All,
I was just trying to understand delegates using the following code.
public class delegatesEx
{
public delegate int Mydelegate(int first, int second);
public int add(int first, int second)
{
return first + second;
}
public int sub(int first, int second)
{
return first - second;
}
}...
Hi,
I need just dictionary or asociative array string => int.
There is type map C++ for this case.
But I need make one map in my class make for all instances(-> static) and this map cannot be changed(-> const);
I have found this way with boost library
std::map<int, char> example =
boost::assign::map_list_of(1, 'a') (2, 'b') (3...
This seems really complicated to ask about so I hope someone can help:
We have a long time running static website held with a hosting company that provide PHP, Ruby-on-Rails and Drupal/Joomla support. A little limited I know but we got reasonably decent search engine rankings and didn't want them to drop. We have two much more recently ...
Hi,
many questions are close, but none answers my problem...
How do I use reflection in C# 3.5 to get all classes which are static from an assembly. I already get all Types defined, but there is no IsStatic property. Counting 0 constructors is really slow and did not work either.
Any tips or a line of code? :-)
Chris
...
I understand that the code below would result segmentation fault because at the cstr of A, B::SYMBOL was not initialized yet. But why?
In reality, A is an object that serves as a map that maps the SYMBOLs of classes like B to their respective IDs. C holds this map(A) static-ly such that it can provide the mapping as a class function.
...
Good evening,
I am developing a set of Java classes so that a container class Box contains a List of a contained class Widget. A Widget needs to be able to specify relationships with other Widgets. I figured a good way to do this would be to do something like this:
public abstract class Widget {
public static class WidgetID {
...
I'm implementing a card game in C. There are lots of types of cards and each has a bunch of information, including some actions that will need to be individually scripted associated with it.
Given a struct like this (and I'm not certain I have the syntax right for the function pointer)
struct CARD {
int value;
int cost;
// ...
Hello, I don't know if it is possible to do this, but I have tried several ways and nothing seems to work. Basically I need to access the same static member from several files which include the same class definition.
// Filename: S.h
class S {
public:
static int foo;
static void change(int new_foo) {
foo = new_foo;
...
I have a singleton instance that is referenced throughout the project which works like a charm. It saves me the trouble from having to pass around an instance of the object to every little class in the project. However, now I need to manage multiple instances of the previous setup, which means that the singleton pattern breaks since each...
I have been told several definitions for it, looked on Wikipedia, but as a beginner to Java I'm still not sure what it means. Anybody fluent in Java and idiot?
Thanks in advance
...
Its a well known fact that a static method can work only on static members.
public static void Main()
{
Test t1 = new Test();
}
Here the Main method is static, but I haven't declared t1 as static. Is it implicitly static?
...
Hello, I am creating an application, which consists of two static libs and an executable.
Let's call the two static libs:
libusefulclass.a
libcore.a
And the application:
myapp
libcore instantiates and uses the class defined in libusefulclass (let's call it UsefulClass)
Now, if I link the application in the following way:
g++ -m64 -W...
I have a class with the following declaration of the fields:
public class Game {
private static String outputFileName;
....
}
I set the value of the outputFileName in the main method of the class.
I also have a write method in the class which use the outputFileName. I always call write after main sets value for outputFileName. But wr...
Statically-typed languages and dynamically-typed languages in principle seem like opposite concepts. However, how can a language like Objective-C for example be both of these things at once? It seems to me that Objective-C is more static than dynamic. Can somebody explain how this is possible?
...
Hello, recently I'm writing some functions that I take from Haskell and translate into Java.
One of the main problems I have is I cannot easily create a static property with a generic type. Let me explain by a little example...
// An interface to implement functions
public interface Func<P, R> {
public R apply(P p);
}
// What I wan...
Hi All
I know this is not a new problem and has been solved, but I still dont know about it :)
I have a class which has functionality to initialise opengl and run it in separate thread.
My problem is: openGL callbacks such as glutDisplayFunc, glutMotionFunc etc accepts
void (*f) void, and I cannot pass class member function.
ways ar...
What is the difference between a static array and a dynamic array in C++?
I have to do an assignment for my class and it says not to use static arrays, only dynamic arrays. I've looked in the book and online, but I don't seem to understand.
I thought static was created at compile time and dynamic at runtime, but I might be mistaken th...
I have a static Preferences class that hold some application preferences and stuff like that. Is it ok to store reference to ApplicationContext there? I need that reference so i can get cache folder and stuff like that in classes that don't inherit Activity.
...