static

Getting the class name from a static method in Java

How can one get the name of the class from a static method in that class. For example public class MyClass { public static String getClassName() { String name = ????; // what goes here so the string "MyClass" is returned return name; } } To put it in context, I actually want to return the class name as part of ...

React to change on a static property

I'm re-writing an MXML item renderer in pure AS. A problem I can't seem to get past is how to have each item renderer react to a change on a static property on the item renderer class. In the MXML version, I have the following binding set up on the item renderer: instanceProperty={callInstanceFunction(ItemRenderer.staticProperty)} Wha...

Using a .lib file from C

I am new to C/C++. I have a static library (.lib) file created using VC++. (I also have .h file for it). And I need to use this in a C program. Can you please help me doing this? Thank you, Prashanth. ...

SQL static data / lookup lists IDENTIFIER

In regard to static data table design. Having static data in tables like shown: Currencies (Code, Name). Row example: USD, United States Dollar Countries (Code, Name). Row example: DE, Germany XXXObjectType (Code, Name, ... additional attributes) ... does it make sense to have another (INTEGER) column as a Primary Key so that all For...

Enforce static method overloading in child class in C++

I have something like this: class Base { public: static int Lolz() { return 0; } }; class Child : public Base { public: int nothing; }; template <typename T> int Produce() { return T::Lolz(); } and Produce<Base>(); Produce<Child>(); both return 0, which is of course correct, but unwanted. Is there anyw...

Java static vs regular objects

While working on my previous problem, http://stackoverflow.com/questions/950636/java-jar-class-not-found-exception I noticed something odd. the class that can not be found is referenced from main. Now if i try to create an instance of the class like SysTray tray = new SysTray(); i get a class not found exception when i try to run th...

Objective-c static instance

Hi! I'd like to create database based models, so I wanna use my own DatabaseModel class to manage the database connection, and every class that uses database is derived from it (it would be a mapping between the model and the table). I'm using a sqlite API. Since I need only one database connection instance, I created a static variable...

IoC (Castle Windsor) and Static Helpers

How do I configure Castle Windsor to use an Initialize method for a static helper class when requesting an object? I am trying to add some extension methods HtmlHelper so it has to be a static class and method. My HtmlHelper extensions depend on a IHtmlHelpersService that is configured with Castle Windsor already. I am using Convention O...

How can I detect if a Java class is called by its own main() or from another class?

I have a Java class that looks like this: public class My_ABC { int a=0; boolean B=true; static // Initialize and load existing data only once at start-up { // need to know if it's called from its own main() // or by another class to conditionally set veriables } public My_ABC(int AA,boolean BB) { } publ...

which has better performance? static versus objects

I have designed a C# console application to merge and split huge files (about 4GB of size) using OOP design. It involves reading/writing xml, flat-files, and images. I have classes for readers and writers. The merging took about 00:12, while the splitting took more than 04:30 hours. Then I've enhanced the performance of the splitting t...

Why cant we have static method in an inner class?

hi why cant we have static method in an inner class and if i make inner class static it works why so ...

Static string variable in Objective C on iphone

Hi, How to create & access static string in iPhone (objective c)? I declare static NSString *str = @"OldValue" in class A. If i assign some value to this in class B as str = @"NewValue". This value persists for all methods in class B. But if I access it in class C (after assignment in B) I am getting it as OldValue. Am I missing somet...

How to staticly-link a complex program

Hello, In Linux, downloaded a program source and want it to be statically linked. Have a huge Makefile there, I ./configure make to compile. prehpes it's a bit too general to ask, but how can I make the binary statically linked? Thanks. EDIT: the reason for this is wanting to make sure the binary will have no dependencies (or at le...

Best Way To Deliver A Static HashTable c#

Hi all! I have the following as an example: public enum HttpRequestHeader { Accept, AcceptCharset } public static class HTTP { public static Hashtable HttpRequestHeaderString { get { Hashtable returnHashtable = new Hashtable(); returnHashtable.Add(HttpRequestHeader.Accept,"Accept"); returnHashtable.Ad...

Processing static files via HttpModule in ASP.NET

I have statiс files in website folder, but need to check permissions for every file. I decided to use HttpModule for that purposes. ASP.NET receives all the http-requests (I used wildcard mapping) and The algorith is the following: HttpModule receives the request HttpModule checks permissions If access is denied then the answer is ...

F# Static Methods In Class

I'm trying to figure out how to make static methods in a class in F#. Does anyone have any idea how to do this? ...

Static constructor equivalent in Objective-C?

I'm new to Objective C and I haven't been able to find out if there is the equivalent of a static constructor in the language, that is a static method in a class that will automatically be called before the first instance of such class is instantiated. Or do I need to call the Initialization code myself? Thanks ...

ASP.Net static objects

I'm trying to cache some information that I've retrieved from a database. I've decided to use a static List<> member to store the information. I know from my experience with List<> in multithreaded applications that I need to protect access to it with the lock statement. Do I treat any code in my Asp.Net code the exact same way? Will the...

Static variable inside template function

In C++, if you define this function in header.hpp void incAndShow() { static int myStaticVar = 0; std::cout << ++myStaticVar << " " << std::endl; } and you include header.hpp in at least two .cpp files. Then you will have multiple definition of incAndShow(). Which is expected. However, if you add a template to the function templa...

How do you properly use a static property that implements IDisposable?

As an example: using (Brushes.Black) { ... } is not a good idea, because it is static. The next time your app goes to use Brushes.Black, you'll have problems, because it has been disposed. Now, if you're only using Brushes.Black, then it's probably ok to not dispose it, because you're only leaving one unmanaged resource (hopefully!) ...