static

PHP 5.2 Virtual-like static methods

Hello all, Here is my situation: I have a PHP base class that looks something like this: class Table { static $table_name = "table"; public function selectAllSQL(){ return "SELECT * FROM " . self::$table_name; } } And a subclass that is like this: class MyTable extends Table { static $table_name = "my_table"; } Unfort...

Are Java static initializers thread safe?

I'm using a static code block to initialize some controllers in a regsitry I have. My question is therefore, can I guarantee that this static code block will only absolutely be called once when the class is first loaded? I understand I cannot guarantee when this code block will be called, Im guessing its when the Classloader first loads ...

raising events in a static class

I have a windows form with a data grid bound to a datatable. On a button click, the data table is passed to a static class. private void btnSave_ItemClick(object sender, EventArgs e) { MyStaticClass.SaveData(DataTable dt); } internal static class MyStaticClass { internal static void SaveData(DataTable dt) { foreach(D...

Any downsides to using statically linked applications on Linux?

Hi. I seen several discussions here on the subject, but wanted to ask about my particular situation: If I have some 3rd part libraries which my application is using, and I'd like to link them together in order to save myself the hassle in LD_LIBRARY, etc., is there any downside to it on Linux, other then larger file size? Also, is it ...

Faking Late Static Binding before php 5.3

I need an inherited static function "call" to call another static function "inner" that has been overridden. I could do this with late static binding, but my host does not have php5.3 yet and so I need to work around it. class ClassA{ static function call() { return self::inner(); } static function inner(){ r...

Overriding a static method in python

Hello, Referring to the first answer about python's bound and unbound methods here, I have a question: class Test: def method_one(self): print "Called method_one" @staticmethod def method_two(): print "Called method_two" @staticmethod def method_three(): Test.method_two() class T2(Test): ...

How is static variable initialization implemented by the compiler?

I'm curious about the underlying implementation of static variables within a function. If I declare a static variable of a fundamental type (char, int, double, etc.), and give it an initial value, I imagine that the compiler simply sets the value of that variable at the very beginning of the program before main() is called: void SomeFu...

Can you require a function parameter to be a static constant of the function's Class?

Let's say I have a Custom Event Class, and it has several Event types stored in static Constant: package customEvents { public class { public static const DISAPPEAR_COMPLETELY:String = "disappearCompletely"; public static const SIT_DOWN:String = "sitDown"; public static const STAND_UP:String = "standUp...

php static function

Hi, I have a question regarding static function in php. let's assume that I have a class class test { public function sayHi() { echo 'hi'; } } if I do test::sayHi(); it works without a problem. class test { public static function sayHi() { echo 'hi'; } } test::sayHi(); works as well. what are diff...

Static member and inheritance

I have a class with a member m_preferences (a vector containing assocation between word and features). In this class the m_preferences is not static and thus any instance of the class has its specific m_preferences. class Base{ private: Preferences m_preferences; public: ... } I then created a derived class where m_preference...

Python - get static information

Hello, i have to get static information from one 'module' to another. I'm trying to write logger with information about code place from where we're logging. For example, in some file: LogObject.Log('Describe error', STATIC_INFORMATION) Static information is class name, file name and function name. I get it from this: __file__ self._...

does specman have static variables?

I have the following code in specman that I inherited: some_method() is { var a: bool; if (!a) { a = some_other_method(); }; }; My understanding is that each time some_method() is called, a is generated anew, and there's no sense in checking a's value before it's assigned. However, it may be that I'm missing some...

.NET Project Reference: How to reference a dll via a referenced project?

Hope I'm asking this correctly: I have a project Projects.Client I have my class library ( infrastructure stuff I use all the time ) Library Assuming these are both projects, how can I do this from a class in the "Projects.Client" using Library; public class xxx { public void DoSomething() { Library.SomeDll.DoS...

How can I make a variable static (or "global") in Classic ASP?

I want to make my variable static or "global" - so the same effect as static in .NET; every session that accesses it gets the same result, and if one session modifies it it affects everyone else too. How can I achieve this in Classic ASP? ...

What is "static"?

I'm beginning to program in Java. public static void main(String[]args) A book said that I should use static in this case, but doesn't clearly say why I should or what it means. Could you clarify this? ...

Inspecting dependencies of static libs / executables

Hi, I have a rather large project with a whole bunch of linked dependencies. The problem is that there's a dependency getting linked to which was compiled with VS 2005 and links with the vc80 debug crt, while I've migrated to VS 2008. The problem is that this also means that I must have the vc80 debug crt installed, something which I'd ...

Can the C main() function be static?

Can the main() function be declared static in a C program? If so then what is the use of it? Is it possible if I use assembly code and call the static main() function myself (consider embedded programs)? ...

Static classes...is it OK to do this?

I read When to Use Static Classes in C# but the top answer didn't necessarily answer my question. I've an application that interfaces with quite a bit of similar hardware, via an HTTP server. Each device must be logged into and the credentials are normally the same. I'm using Properties.Settings.Default.etc to handle application wide set...

Creating multiple instances of global statics in C++?

One of the libraries we are using for our product uses a singleton for access to it. I'm pretty sure it's implemented as a static instance (it isn't open source). This works well for a single document application, but our app may have more than one document loaded. I'm assuming access to the instance is written something like this: Inst...

Easiest way to convert a PHP page to static HTML page

I want to convert a web pages which is heavily CSS styled is written in PHP to static html so that I can embed it in an email. I have managed to do this but for achieving this I had to convert the whole page into a string and then assign that string as email body. The layout of the page does not look as good as original as I have not be...