static

Difference between singleton class and static class?

Possible Duplicates: Difference between static class and singleton pattern? What is the difference between a Singleton pattern and a static class in Java? HI I am not clearly getting What’s the difference between a singleton class and a static class? Can anybody elaborate this with example? ...

ASP.NET Global/Static storage?

I have a thread-safe object which is part of an API previously used in windows service/client scenarios. This thread-safe object is essentially a singleton and stored in a static variable so that all callers can access the same state. This API has recently started being used in an ASP.NET application, and I suspect that some funky behav...

Tomcat configuration for development, how to add a webapp, as well as reference static files

I want to have a web app and then configure it to load static files from a direct path. This is the webapp configuration: <Context docBase="E:\webapp1" path="/" reloadable="true"/> How do I setup the static resources. ...

C#: Type specific/static methods supporting overriding

In C# it is not possible to override a static method. Nevertheless I have some type specific methods (instead of the usual instance methods) and I want to give the user the ability to override those methods, and in addition, have the ability to call those (overridden) methods from my own code without knowing about the 'overriding' done b...

If i extend a static class in PHP, and the parent class refers to "self::", will this refer to the self in the extended class?

If i extend a static class in PHP, and the parent class refers to "self::", will this refer to the self in the extended class? So, for example <?php Class A { static $var public static function guess(){self::$var = rand(); return $var} } Class B extends Class A { public static function getVar(){return self::$var...

how can I use static library build by different version of mingw?

Greetings, I am facing a complicated situation about using a static library under windows. The static library is build by a specific version of mingw which is bundled with Eiffel studio. Since Eiffel studio uses mingw to create its output as a static lib, I have no control over this configuration. If I try to use this static library w...

Accessing control attributes from static function

Here's what I've got: <textarea id="TextArea1" rows="6" cols="20" runat="server"></textarea> and in the code-behind: partial class _Default : System.Web.UI.Page { [Webmethod()] public static void Data(int TestNum) { if (TestNum > 0) TextArea1.InnerText = "hello world"; } } And I'm getting the following error...

Can static local variables cut down on memory allocation time?

Suppose I have a function in a single threaded program that looks like this void f(some arguments){ char buffer[32]; some operations on buffer; } and f appears inside some loop that gets called often, so I'd like to make it as fast as possible. It looks to me like the buffer needs to get allocated every time f is called, but ...

Why static Structures are not allowed in C#?

I always used to consider structures as some sort of lesser privileged things, or something with lesser features. Maybe because of the OOP concepts blowing everything into Classes. From the little amount of exposure to C#, I understand that Setting a class static, ensures that all its members & functions are static. Also we cannot have...

Code from the Statically linked library not working.

I have made some changes in the static library, I don't see any difference in the code when I am debugging code. debugger is going through the new code but it's not doing anything. please help, Best wishes. ...

Why do static libraries end in '.a' c++/c ?

Just doing a little work this morning making some static libraries and wanted to know why static libraries end with '.a'. No one in my office knew so I thought I would ask around on SO. We are writing code in C++/C/Obj-C ...

Static Library iPhone NSKeyedUnarchiver Error

Hey guys, I made a custom Static Library that I use in my iPhone project. Everything works great except for when I use an NSKeyedUnarchiver to unarchive some data. It throws an exception when I try and use it in the library. I tried copying the classes of my static library into my project to see if that would work and it works fine but t...

C++ static variable

I am trying to design header only library, which unfortunately needs to have global static variable (either in class or in namespace). Is there any way or preferred solution to have global static variable while maintaining header only design? The code is here ...

Problem when Serving static files in Django

I have my css file in /var/www/media/static/style.css and added (r'^media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': '/var/www/media/static'}), to my urls but when I go to http://localhost:8000/media/style.css I get: "Page not found: /media/style.css" what is wrong? ...

C++ static initialization

what should be the behavior in the following case: class C { boost::mutex mutex_; std::map<...> data_; }; C& get() { static C c; return c; } int main() { get(); // is compiler free to optimize out the call? .... } is compiler allowed to optimize out the call to get()? the idea was to touch static variable t...

Weird iPhone static framework device-specific behavior with random NSString reads.

I am getting a weird behavior on the iPhone device where it reads random strings it seems to have in memory or stored away somewhere and putting them where they don't belong. For example I have a navigation controller in the project and I put this in my code: self.navigationItem.title = @"Title"; And the title shows up as some other s...

How to specify argument type in a dynamically typed language, i.e. Python?

Is there any such equivalent of Java String myMethod (MyClass argument) {...} in Python? Thank you, Tomas ...

Lucene .NET fixed filenames in index directory possible?

When building a Lucene .NET index it creates several randomly named files under the root index directory. My question is, is there a way to have these files have a static or fixed name and just overwrite upon re-index, or all be in one file? ...

How can I create extension methods with static return type?

Hi I was trying to write a simple extension method for Color static class which return Black and White equivalent of that color. The problem is that extention methods can't return Static types... So, how can I do this?! please help me. ...

Usage of constants from interface

Recently i came across static import feature available in java . But was not so happy as this is available only for 1.5 or above. We work on jdk 1.3 and constantly implement interface just for the ease of accessing the constants. But i feel this is a wrong way of utilizing inheritence. Is there any alternative for this? other than of cou...