I have a page that is hitting a webservice every 5 seconds to update the information on the page. I'm using the DynamicPopulateExtender from the Ajax Control Toolkit to just populate a panel with some text.
What I was wanting to do, is if a certain condition is met, to refresh the page completely.
Am I going to be able to do this in t...
On an ASP.NET website, are static classes unique to each web request, or are they instantiated whenever needed and GCed whenever the GC decides to disposed of them?
The reason I ask is because I've written some static classes before in C# and the behavior is different than I would have expected. I would have expected static classes to b...
Very simply put:
I have a class that consists mostly out of static public members, so I can group similar functions together that still have to be called from other classes/functions.
Anyway, I have defined two static unsigned chars in my class' public scope, when I try to modify these values in the same class' constructor, I am gettin...
I'm working on a project in C#. The previous programmer didn't know object oriented programming, so most of the code is in huge files (we're talking around 4-5000 lines) spread over tens and sometimes hundreds of methods, but only one class. Refactoring such a project is a huge undertaking, and so I've semi-learned to live with it for no...
C++ guarantees that variables in compilation unit (.cpp file) are initialised in order of declaration. For number of compilation units this rule works for each one separately (I mean static variables outside of classes) , but order between them is undefined.
Where I can see some explanations about this order for gcc and MSVC (I know tha...
I would like to know what is the difference between initializing a static member inline as in:
class Foo
{
private static Bar bar_ = new Bar();
}
or initializing it inside the static constructor as in:
class Foo
{
static Foo()
{
bar_ = new Bar();
}
private static Bar bar_;
}
...
I've figured out how to set VC++ to compile code into a .lib file instead of a .exe, but I'm having trouble getting a lib to link together with my other .obj files.
Here is how I have the library and application folders set up. (I'm not sure if this is right)
AppFolder
App.sln
App.ncb
*.h
*.cpp
Debug
*.obj
App.exe
...
Here's what MSDN has to say under "When to Use Static Classes":
static class CompanyInfo
{
public static string GetCompanyName() { return "CompanyName"; }
public static string GetCompanyAddress() { return "CompanyAddress"; }
//...
}
Use a static class as a unit of
organization for methods not
associated with parti...
If a variable is declared as static in a function's scope it is only initialized once and retains its value between function calls, we all know that but what exactly is its lifetime? When do its constructor and destructor get called?
void foo()
{
static string plonk = "When will I die?";
}
P.S. For those who want to know why I...
I'm a fan of extension methods in C#, but haven't had any success adding an extension method to a static class, such as Console.
For example, if I want to add an extension to Console, called 'WriteBlueLine', so that I can go:
Console.WriteBlueLine("This text is blue");
I tried this by adding a local, public static method, with Consol...
I have the following legacy code:
public class MyLegacyClass
{
private static final String jndiName = "java:comp/env/jdbc/LegacyDataSource"
public static SomeLegacyClass doSomeLegacyStuff(SomeOtherLegacyClass legacyObj)
{
// do stuff using jndiName
}
}
This class is working in a J2EE-Container.
Now I would lik...
I am building a relatively simple django app and apart from the main page where most of the dynamic parts of the application are, there are a few pages that I will need that will not be dynamic at all (About, FAQ, etc.). What is the best way to integrate these into django, idealing still utilizing the django template engine? Should I jus...
Hi All,
I was looking at the Java code for LinkedList and noticed that it made use of a static nested class Entry.
public class LinkedList<E> ... {
...
private static class Entry<E> { ... }
}
What is the reason for using a static nested class, rather than an normal inner class?
The only reason I could think of, was so that Entry ...
What is the right way to perform some static finallization?
There is no static destructor. The AppDomain.DomainUnload event is not raised in the default domain. The AppDomain.ProcessExit event shares the total time of the three seconds (default settings) between all event handlers, so it's not really usable.
...
In C++ when can a virtual function use static binding? If it is being accessed through a pointer, accessed directly, or never?
...
Hello.
I have a simple question. Is there a way ( using reflections I suppose ) to iterate all the static values of a class?
For instance
class Any {
static int one = 1;
static int two = 2;
static int three = 3;
public static void main( String [] args ) {
for( int i : magicMethod( Any.class ) ){
...
Howdy,
I have a public static class in which I would like to have a ToString() method.
I have defined it as public static string ToString(), but get the following warning:
'Class.ToString()' hides inherited member 'object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwi...
I've been thinking of ways of providing syntactic sugar for a framework I have been working on. I want to deal with Immitable objects exclusively.
Say I have an immutable object and wish to create a modified version of it. Would, in your view, a non-instantiable class with a single static factory method break OO principles ?
As an...
Howdy,
I have an assembly that may be used by more than one process at a time. If I am using a static class, would the multiple processes all use the same "instance" of that class?
Since the processes are separate, would these be running under difference Application Domains, hence have the static "instances" separate?
The pudding...
The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message.
You can either make the non static method static or make an instance of that class to use its properties.
Why? I am not asking for solutions. I would be grateful...