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 have a server application (singleton, simple .NET console application) that talks to a GlobalCache GC-100-12 for the purpose of routing IR commands. Various .NET WinForm clients on the local network connect to my server application and send ASCII commands to it. The server application queues these ASCII commands and then sends them to ...
I've defined a helper class to keep track of a small dictionary of items. it stores this information as a static property, which is initialized in the static constructor. the list is very small and will never change so I chose this method over xml or a db lookup table...
however what I would like to know is, will this static property re...
Hello everyone,
I am confused about ASP or ASP.Net session life time (or life cycle) concepts. More specifically, my confusions are,
how did IIS magically knows a new session starts and an existing session ends? Especially how IIS treats whether a session continues or ends when we call redirect code;
how many differnet ways to set ses...
If I have a class called Test ::
class Test
{
static std::vector<int> staticVector;
};
when does staticVector get constructed and when does it get destructed ?
Is it with the instantiation of the first object of Test class, or just like regular static variables ?
Just to clarify, this question came to my mind after reading Conce...
Where can I find a detailed view of the lifecycle of a Windows Service as developed in .NET? I put my question this way because I am not sure that a detailed enough description can be posted here, but if you think you can please feel free to try.
An example of an incorrect answer would be a paste of the description from the MSDN page: I...
Hi,
A few days ago I had this issue with ASP.Net threading. I wanted to have a singleton object per web request. I actually need this for my unit of work. I wanted to instantiate a unit of work per web request so that identity map is valid through out the request. This way I could use an IoC to inject my own IUnitOfWork to my repository...
What happes when the scrip that made @mysql_connect($server, $user, $password) dies?
How long does it live?
Thank you!
...
We have an engaged (but friendly) discussion between coworkers about the life time of the SSL session underlying a https communication.
When I establish a https connection to a server using a normal browser the underlying ssl creates a session (including a shared secret) using asymmetric encryption, the rest of the communication is encr...
Maybe this is an obvious question, maybe it isn't. Imagine a GUI control application where every button push calls a different function on a remote WCF service. Button usage is frequent at approximately every few seconds. In general is it best to open and close the WCF channel every function call or hold the channel open for the lifetime...
I'm new to NHibernate, and have seen some issues when closing sessions prematurely. I've solved this temporarily by reusing sessions instead of opening a session pr transaction. However, I was under the impression that opening sessions each time you need them was the recommended approach for session lifetime management. No?
So; what is...
The C++ Standard, paragraph 15.1.4 sais:
The memory for the temporary copy of the exception being thrown is allocated in an unspecified way, except as noted in 3.7.3.1. The temporary persists as long as there is a handler being executed for that exception.
I'm wondering why this code crashes (I know that it's not best practice):
c...
I am generating the vertex arrays on the fly on each render and I want to delete the arrays afterwards. Does glDrawArrays immediately copy the vertex arrays to the server? Hence is it safe to delete the vertex arrays after calling glDrawArrays?
float * vp = GetVertices(); // Regenerated on each render
glVertexPointer(3, GL_FLOAT, 3 * s...
I've made this to call unmanaged function from C code. pCallback is a function pointer so on the managed side is a delegate.
[DllImport("MyDLL.dll")]
public static extern Result SetCallback(
IntPtr handle,
Delegate pCallback,
CallbackType Type);
Now I am setting
public delegate void pfnCallba...
hello
I have code that looks like this:
class T {};
class container {
const T &first, T &second;
container(const T&first, const T & second);
};
class adapter : T {};
container(adapter(), adapter());
I thought lifetime of constant reference would be lifetime of container.
However, it appears otherwise, adapter object is destroyed...
What is the lifetime of a variable in javascript, declared with "var".
I am sure, it is definitely not according to expectation.
<script>
function(){
var a;
var fun=function(){
// a is accessed and modified
}
}();
</script>
Here how and when does javascript garbage collect the variable a? Since 'a' is a part of ...
I have the following generic lifetime manager
public class RequestLifetimeManager<T> : LifetimeManager, IDisposable
{
public override object GetValue()
{
return HttpContext.Current.Items[typeof(T).AssemblyQualifiedName];
}
public override void RemoveValue()
{
HttpContext.Current.Items.Remove(t...
What is the advantage and disadvantage of connection timeout=0?
And what is the use of Connection Lifetime=0?
e.g (Database=TestDB;port=3306;Uid=usernameID;Pwd=myPassword;Server=192.168.10.1;Pooling=false;Connection Lifetime=0;Connection Timeout=0)
and what is the use of Connection Pooling?
...
Hello,
I'm working in a RIA. We use Memcached to store sessions, and I've installed http://pecl.php.net/package/memcache and my PHP session handler looks like this:
$session_save_path = "tcp://$host:$port?persistent=1&weight=2&timeout=2&retry_interval=10, ,tcp://$host:$port ";
ini_set('session.save_handler', 'memcache');
ini_set('ses...
This should be a simple question but I haven't managed to find the answer on google.
I would like to know, in terms an idiot can understand, exactly what application lifetime means in ASP.NET (and therefore when you can expect application start and end events to run).
I assumed it would be when you run and stop the app in IIS, but I've...