static

Is it possible to get CMake to build both a static and shared version of the same library?

Same source, all that, just want a static and shared version both. Easy to do? ...

Is there a way to force static fields to be initialized in C#?

Consider the following code: class Program { static Program() { Program.program1.Value = 5; } static List values = new List(); int value; int Value { get { return value; } set { this.value = value; Program.value...

Class-level Static Variable per Instance.

Hi, I'm trying to do the following: I need a static variable to get a ListItemCollection from a List control (I can do this, but if I don't set it as Shared It's not preserving the values as it should). The thing is that this class is a SharePoint webpart, so I most probably will be using the webpart more than once, and I need this vari...

How can I initialize a static pointer in C?

I want to use a static pointer in a function in order to point to a number of integers. The number of integers is not yet known while programming but it is known on runtime before the function is used first. So I want to give the function a parameter n and tell it to allocate memory space for n integers to the pointer and keep this. Howe...

Is it possible to host a static html website in google app engine?

How do I set index.html for the default root web page? application: dfischerdna version: 1 runtime: python api_version: 1 handlers: - url: / static_dir: static_files This works great when the visitor types http://dfischerdna.appspot.com/index.html However I would like that when he types this, the index.html web page would...

Static variable of procedure in Delphi

What is difference in memory management of variables a and b? Are they both similar static variables but visibility of b is local? Is it ok to declare static variable in procedure or function? const a: string = 'aaa'; procedure SubMethod; const b: string = 'bbb'; begin a := a + 'a'; b := b + 'b'; end; ...

[C#] Odd Static Class Issue

Below is my very simple static class. Not sure what is wrong. I am using it in a non static class that has a correct "using" statement. Intellisense sees the class and its one method. I am getting the error The name 'SQLUserDataManager' does not exist in the current context". public static class SQLUserDataManager { ...

Static member inheritance in C#

I have a number of classes that reflect tables in a database. I would like to have a base class that has some basic functionality (say, it would have a "isDirty" flag), and a static array of strings with the column names as they appear in the database. The following code doesn't work but illustrates what I would like to do: public cla...

static vs non-static method for immutable class

Given the class definition below. How would one go about deciding whether the stub methods should be static or non-static? class Point { private final int x; private final int y; public Point(int x, int y) { this.x = x; this.y = y; } // Should the methods add(), subtract() and inverseOf() be non-sta...

In C++, are static initializations of primitive types to constant values thread-safe?

i.e., would the following be expected to execute correctly even in a multithreaded environment? int dostuff(void) { static int somevalue = 12345; return somevalue; } Or is it possible for multiple threads to call this, and one call to return whatever garbage was at &somevalue before execution began? ...

Static function access in other files

Hi, Is there any chance that Static function can be assessed outside the file scope. ? ...

Static library inspector for windows?

I know there are tools like PE Explorer for inspecting the contents of DLLs on windows (exported symbols, etc). Is there something similar for static libraries? I'm linking against a third party library that's generating some linking errors, and I want to double check that the symbols I expect are indeed being provided. ...

Entity Framework - Scoping context in a web app

Hi I have implemented a simple repository pattern for the Entity Framework in a web app. I have several repositories which all subclass a base which has some common methods in The base looked like this public class BaseRepository<TEntity> : IRepository<TEntity> { protected readonly RedirectsEntities Context; public BaseRepos...

How to assign a value from a C# static method to a label

Hi, I have the following static function in c# public static string Greet(string name) { string greeting = "welcome "; // is it possible to pass this value to a label outside this static method? string concat = string.Concat(greeting, name); //error Label1.text = concat; //I want ...

Use of static objects in asp.net

I am using the followign object in my asp.net page private static Dictionary<string, List<Guid>> OpenNodes = new Dictionary<string, List<Guid>>(); //Page start if(!OpenNodes.ContainsKey(Session.SessionID)) { List<Guid> list = new List<Guid>(); OpenNodes.Add(Session.SessionID, list); } //User clicked on a node Guid ...

What are 3 possible situations in which static methods might be included in classes?

I got this question for homework, and all I can think of is to return a subclass of an abstract superclass. Thanks! ...

Why before ALL functions (except for main()) there is a 'static' keyword ?

I was reading some source code files in C and C++ (mainly C)... I know the meaning of 'static' keyword is that static functions are functions that are only visible to other functions in the same file. In another context I read up it's nice to use static functions in cases where we don't want them to be used outside from the file they are...

C++ static template member, one instance for each template type?

Hi, Usually static members/objects of one class are the same for each instance of the class having the static member/object. Anyways what about if the static object is part of a template class and also depends on the template argument? For example, like this: template<class T> class A{ public: static myObject<T> obj; } If I would c...

Why doesn't Java allow overriding of static methods ?

Why is it not possible to override static methods? If possible, please use an example. ...

Why are static classes used?

I have doubts on static class and static methods. From MSDN I understood that "Static classes and class members are used to create data and functions that can be accessed without creating an instance of the class." So if we don't want to associate a class over an instance , we will make it as static. Is that the only advantage? Can anyo...