I have to call a callback method in iframe to return a value to opener.
I know SqueezeBox has "assign, open, close" static methods, but I do not understand how it works, can someone help me please?
...
I would like to know if C# automatically implemented properties like "public static T Prop{get;set;}", are thread safe or not. Thanks!
...
I discovered 'ThreadStaticAttribute', and I have a lot of questions about it:
all my previous thread dependent static informations, were implemented as a static dictionary wich TKey is Thread, and when I wanted to access it, I used Thread.CurrentThread and that works. But this requires mantainance, because if a thread dies, I have to del...
I have a class that has 5 static public functions and 1 static private function (called from one of the public functions). The class doesn't have any member variables. It seems to me that it should be a namespace and not a class. But what to do with the private function? I prefer it not to be accessible by every namespace user, but there...
I'm playing around with an eager-initializing generic singleton class. The idea is that you inherit publicly from the class like so:
class foo : public singleton<foo> { };
I've learned a lot in the process but I'm stuck right now because it's breaking my Visual Studio 2008 linker. The problem is with the static instance member and/or ...
For example:
<?php
function get_current_user_id(){
static $id;
if(!$id){
$id = 5;
echo "Id set.";
}
return $id;
}
$id = get_current_user_id();
$id2 = get_current_user_id();
$id3 = get_current_user_id();
echo "IDs: ".$id." ".$id2." ".$id3;
?>
//Output:
Id set.ID...
I'm trying to use xlsLib (http://xlslib.sourceforge.net/) for creating Excel spreadsheets from a C++ application. The trouble is that compiling xlsLib, I give a .a file (a GCC static library, generated by MinGW). But, my application depends on another API (PhysX) that only compiles with Visual Studio. Thus: is it possible to transform th...
Possible Duplicate:
When should I use static methods in a class and what are the benefits?
I'm working in PHP right now.
I'm working on two groups of Functions.
I have a class which consists of Date Handling Functions.
In this class I have no need for properties as each function/method is more or less a utility. As such I hav...
Need to post data from a static html page to another page which is hosted on another domain. Normally I'd create and iframe with a form inside of it with a post method, and whose actions is directed to that web page, and finally submit that form. The complexity is I'd collect data from my static html page and create a similar (replica) f...
Hi all,
I would like to use the tm struct as a static variable in a class. Spent a whole day reading and trying but it still can't work :( Would appreciate if someone could point out what I was doing wrong
In my class, under Public, i have declared it as:
static struct tm *dataTime;
In the main.cpp, I have tried to define and initia...
Hi,
I have a static nested class, which I would like to return via a static accessor (getter).
public class SomeClass
{
public static class Columns<CC>
{
...
public static int length = 5;
}
public static Columns<?> getColumnEnumerator()
{
int x = Columns.length; //no problems
retur...
Hi!
I want to calculate how much queries are executed when i request a page in asp.net mvc. Difficults in page logic: sum queries are executed in main controller action, but others - in widget controller actions, which are called by Html.ActionLink in master page.
I wrote base class for all controllers in which i'm encapsulate query c...
Possible Duplicate:
Advantage of Static class over use of Singleton
Usually, everytime I needed a single systemwide object I used the singleton pattern.
M question is, why shouldn't i just implement the object as static and get the single object behaviour naturally ? Are there any cons to use static types over singleton factore...
Hello,
I'd like to store some properties in a static closure and later access them during a method call:
class Person {
static someMap = { key1: "value1", key2: "value2" }
}
So how can I write a method within Person, which retrieves this stored data?
Regards,
Peter
...
Hello,
Just want to make sure I am not assuming something foolish here, when implementing the singleton pattern in an ASP .Net web application the static variable scope is only for the current user session, right? If a second user is accessing the site it is a different memory scope...?
Thanks
...
Hi,
I have this code:
public class EntityMapper<T> where T : IMappingStrategy, new()
{
private static T currentStrategy;
public static T CurrentStrategy
{
get
{
if (currentStrategy == null)
currentStrategy = new T();
return currentStrategy;
}
}
}
Th...
I have the following situation. There is some very common class in my application that contains a static readonly field called "BinDirectory" that holds the path to the bin directory. Other fields in this class, which are static readonly too, use this value to as a base to their value. On the current version BinDirectory is initialized t...
Hi,
If we store objects in static fields of an object, how does the JVM allocate the memory for it? Does it live within "implicit"(not sure if I am using the right word) class object? How are static fields different from object fields?
...
Hi,
I'm currently trying to implement a factory as a singleton. I practically used the textbook example of the Singleton pattern. Here's the .h file:
namespace oxygen{
class ImpFactory{
public:
static boost::shared_ptr<ImpFactory> GetInstance();
private:
static boost::shared_ptr<ImpFactory> mInstance;
};
and here's the .cp...
Given that a static variable of a class takes only one memory location, is it shared by all threads of process? Or is one memory location for such a variable created for each of the running threads?
Also, if all threads share the same memory location, how can we ensure mutual exclusion?
...