static

How to access a private member inside a static function in PHP

I have the following class in PHP class MyClass { // How to declare MyMember here? It needs to be private public static function MyFunction() { // How to access MyMember here? } } I am totally confused about which syntax to use $MyMember = 0; and echo $MyMember or private $MyMember = 0; and echo $MyMember or $this->My...

Where to store static methods in OOP?

I have a Blog class that does exactly what you think it would...create an object and handle it. That part is nice and clean. I am now in need of a function that will quickly return a number of all the blogs in my database (not necessarily related to the blog object). Therefore, I am thinking a static method would be a good choice. My q...

Is C++ static member variable initialization thread-safe?

Hi! According to following resources, in C++(Specially Visual C++) scoped static variable initialization isn't thread safe. But, global static variables are safe. http://stackoverflow.com/questions/1052168/thread-safe-static-variables-without-mutexing http://blogs.msdn.com/oldnewthing/archive/2004/03/08/85901.aspx So, is following co...

In Java- "Static Members of the default package cannot be imported"- Can some one explain this statement?

In Java- "Static Members of the default package cannot be imported"- Can some one explain this statement? It would be better if its with an example. I am not sure if it has a really simple answer but then I tried to understand but couldn't figure it out. ...

Passing parameters to a static method with PHP

Hello, I'm building my own framework, and I'm trying to pass a parameter to a static method. For some reason, the parameter is not getting passed. Here is the code: Front.php: if(URI::get(0) === "") URI.php: public static function get($index) { die($index); if(!filter_var($index, FILTER_VALIDATE_INT)) { ...

mysql-python: building a completely standalone _mysql.so on Mac OS X?

I'm running a database server in a Linux VM (Ubuntu 9.10) under VMware Fusion, but coding Django on the Mac side. Installing mysql-python requires that MySQL is installed on the Mac for compiling _mysql.so into site-packages. However, after this is done, I have no further use for MySQL on the Mac side, and would rather just delete it. O...

Crash at static object destruction

I am working on a 3rd party c++ app. It is crashing during the exit. If I look at the stack all I get is the __static_initialization_and_destruction_0 function and lots of questions marks. Project is huge and unfortunately it has many static objects. Is there any way to find out which one is crashing? ...

does static methods need to use static properties ??

I am using as3. Just a simple question. If I created a static method. say I decide to call on other methods within that static method. Do those methods I call on need to be static as well? what If I used some of the properties. Not to store data permanently, but just within that process. Do those properties need to be static ?? ...

autoversioning image links INSIDE css and javascript files?

Hi folks! Inside my PHP application, I'm already successfully autoversioning my static content (CSS, JS, and images), so my URLs look something like this: <link rel="stylesheet" href="http://example.com/include/css/global.1262063295.css" type="text/css" media="all" /> <img src="http://example.com/images/logo.1254284339.png" alt="" /> ...

Why won't my C++ program link when my class has static members?

I have a little class called Stuff that I want to store things in. These things are a list of type int. Throughout my code in whatever classes I use I want to be able to access these things inside the Stuff class. Main.cpp: #include "Stuff.h" int main() { Stuff::things.push_back(123); return 0; } Stuff.h: #include <list> ...

How to solve a problem in using RAII code and non-RAII code together in C++?

We have 3 different libraries, each developed by a different developer, and each was (presumably) well designed. But since some of the libraries are using RAII and some don't, and some of the libraries are loaded dynamically, and the others aren't - it doesn't work. Each of the developers is saying that what he is doing is right, and ma...

Get current ISO8601 date/time stamp

Hello, I would like to get the current date/time stamp of the server or client in ISO8601 format (ex. 31 Dec 2009, 02:53). I know that server time can be observed using PHP and brought into the DOM using jQuery $.getJson. Client side time can be recorded from the browser using javascript/jQuery. I want the time stamp to be static (not d...

static initialization in c

I have a function which is passed a list of ints, until one value is "-1" and calculates the minimum. If the function gets called couple times, it is supposed to return the minimum between all calls. So I wrote something like that: int min_call(int num, ...) { va_list argptr; int number; va_start(argptr, num); //stat...

How to write correct static methods - multithread safe

As I assume static methods shouldn't be writen like the first snippet , or am I wrong ? public static class ExtensionClass { private static SomeClass object1; private static StringBuilder sb; private static string DoSomething() { sb.AppendLine(object1.SomeValue); } public static string ExtensionMethod(this HtmlHelper helper,...

Problem with static attributes

My problem is that I'm working on a project that requires me to run multiple instances of someone elses code which has many static attributes/variables, which causes all the instances to share those resources and, well, crash. I can run multiple instances of this other person's program if I create a .jar file off of it and open it multip...

What is the C# equivalence of startup module we had in vb6.0?

hi What is the win-based application developing with C# equivalence of startup module we had in vb6.0? a static class ? or what? ...

What are static variables?

What are static variables designed for? What's the difference between static int and int? ...

Get value of variable in ASP.NET from within a static/shared class using reflection

Hi, I have a VB.NET website which has a static (shared) class from which I need to obtain the value of specific variables that may exist anywhere in the application's scope. The reason I have this need is that I have snippets of text coming from a database which contain embedded variable names, such as [[FirstName]]. I need to repla...

[C++] MSVC and FreeGlut Compiler Error

Receiving alot of these messages when compiling which is making compiling a simple program very time consuming. freeglut_static.lib(freeglut_callbacks.obj) : warning LNK4204: 'z:\CST328\Lab1\block\Release\vc90.pdb' is missing debugging information for referencing module; linking object as if no debug info 1>freeglut_static.lib(freeglut_...

ASP.NET AJAX JavaScript files served from a static location.

Hi, I realise that this is going to be a fairly niche requirement and will almost certainly raise a few "WTF's" but here goes... Within an ASP.NET Webforms application I need to serve static content from a local client machine in order to reduce up-front bandwidth requirements as much as possible (Security policy has disabled all Brows...