static

Multiple dynamic libraries with the same static variables, how many instances?

Let me explain it with an example: I have a class S, which is static. I have two dynamic libraries A and B that use S. I have an application, that links with A and B, in this application, how many different instances of S are created? All this using C++ and in Ubuntu. Thanks in advance ...

Inherit a Static Variable in Java

I want to have the following setup: abstract class Parent { public static String ACONSTANT; // I'd use abstract here if it was allowed // Other stuff follows } class Child extends Parent { public static String ACONSTANT = "some value"; // etc } Is this possible in java? How? I'd rather not use instance variables/met...

OpenCV c++ application deployment with external libraries

Hi, I've tried searching A LOT for this with no luck (possibly because I'm not using the right technical terms). My issue is mainly to do with linking static libs, compiling and deploying. Before I get into details, my executables compile fine on my system; the main issue is how to deploy these as a working solution to others. I've wr...

Static headers on a listview

I have a ListActivity with obviously a ListView on it. This ListView consists of different sections, each of them have a header. When I display the list of items to the user, first header is on top. If user scrolls, header is hidden and rest of items are displayed. I know how to make that simple header static, always on top, but what i ...

Illegal declaration of a property and a static function. why?

Can somone explain why I get this error on this code? Error 1 The type 'ConsoleApplication1.TestClass' already contains a definition for 'IsThisOK' class TestClass { public bool IsThisOK { get; set; } public static bool IsThisOK(string str) { return true; } public st...

Is there any use for a private constant, that is not static?

Is there any reason to have a private constant, that is not static? Are there any situations that you would need a non-static private const? Would it make sense if constants where static by default? I use ActionScript3 and some Java, but I think this is a broader OOP question. ...

Django: How Add Static Files

Readed all these topic http://stackoverflow.com/search?q=django.views.static.serve And it not helped :( OS: Windows XP Python: 2.7 Django: 1.2.3 Media in D:\bugtracker\static With files: docicons-note.gif style.css In settings.py i set: MEDIA_ROOT = 'D:/bugtracker/static/' MEDIA_URL = '/static/' In urls.py i set: urlpatterns = pa...

Have I good sense of static method

I have class Country which has collections of Cities. At client I use webmethod [WebMethod] public void AddCity(string countryCode,string name) { MyFacade.AddCity(countryCode,name); } at Facade I have method public void AddCity(string countryCode,string name) { Country.AddCity(countryCode,name); <-in this method is simple sql opera...

Using Static constructors to create a singleton in C#

Hi all, I've been looking at the article on creating static constructors in c# here: http://csharpindepth.com/Articles/General/Singleton.aspx Now, one option he doesn't mention is using a simple static constructor. Is there any issue with doing something like the below? If it works, it seems simpler than his complicated solutions IMHO...

How to find version of a static lib *.a ?

Is there a terminal command which I can use to see the version of a static library (*.a) on my Mac? ...

Static member object initialization failure

I have a static library with the following code: h file: class Foo { public: Foo() { a = 4; } int a; }; class Bar { public: static const Foo foo; }; cpp file: const Bar::foo = Foo(); My problem is that Bar::foo does not get initialized with a=4 until some time after main(). Before then a=0. I'm trying to ...

Can you reflect on a private static method in Java

Hey, First of all this is not some normal action I would want to do, however this fringe case involving alot of legacy code I cannot touch, and unit tests that need to be written for newer stuff. Anyway I have a class and I can get access to all fields and methods through reflection, except private/protected static ones. So is there an...

c++ (non-built in/class) static member

#include <iostream> #include <string> class c1 { public: static std::string m1; static unsigned int m2; }; //std::string c1::m1 = std::string; unsigned int c1::m2 = 0; void main() { c1 a; //std::cout<<a.m1<<std::endl; std::cout<<a.m2<<std::endl; } In this program enabling the two remarked lines causes an error on the first. ...

Are C++ static simple types initialized in order?

My experience tells me that given an object: class Object { private: static int array[]; public: Object(int id); }; int Object::array[] = { 2937, 892 }; Object::Object(int id) { // do something } The initialization of array will happen before the invocation of any method on Object or the invocation of any method on an...

static mutable member variables in C++?

Hello, why or for what reason is it not possible to declare a class member variable in C++ as "static mutable"? Something like static mutable int t; //This won't compile For me, there is no reason to ban such declarations. E.g. for reasons like maintaining a global class-wide statistics, it may be convenient to have static variable t...

Static effect on memory

Static effect on memory how much ? ...

Global initialized variables declared as "const" go to text segment, while those declared "Static" go to data segment. Why?

#include <stdio.h> const int str[1000] = {0}; int main(void) { printf("arr is %d\n", str[0]); return 0; } Has the following output: [-exercises/adam/stack2]:size a.out text data bss dec hex filename 5133 272 24 5429 1535 a.out Whereas: #include <stdio.h> static int str[1000] = {0}; in...

C "Static" Optimization

Hello. I'm reading the book about optimization teckniks. There is not much description or advices in example though. Here's the thing: int agag(int a) { static int dfdfdf = 0; static int prev_resilt = 0; if (dfdfdf == a) return prev_result; dfdfdf = a; a = SomeCalcs(); prev_result = a; return a; } The key thing is: i...

When to put static function definitions in header files in C?

Hi, I've come across some code that has a large static function in a header file and i'm just curious when it is/is not ok to do this. For example, if many .c files include the header, why not just define the function non-static and link it in ? Any advice or rules of thumb on when/when not to put static function definitions in header ...

what is the best c++ wrapper to webkit ? for staticlly linking (not QWebkit)

i need to statically embed web browser in c++ , webkit is good idea , is there any easy c++ wrapper around this kit , i know the Qt version but i can only dynamically link it and its no good for me. ...