static

Do static classes cause performance issues on multi-core systems?

Hi folks, the other day a colleague of mine stated that using static classes can cause performance issues on multi-core systems, because the static instance cannot be shared between the processor caches. Is that right? Are there some benchmarks around proofing this statement? This statement was made in the context of .Net development (w...

Function call jumps to the wrong function.

I am compiling a c++ static library in vs2008, and in the solution i also have a startup project that uses the lib, and that works fine. But when using the lib in another solution i get an run-time check failure. "The value of ESP was not properly saved across a functioncall" Stepping through the code i noticed a function foo() jumping...

does Google analytics make a major effect on time to download a static web page?

Hi, I understand that by simply adding a script to the end of the body tag of a html document one makes it processable by Google analytics. My question is, is this likely to have much effect on performance (download time and server load)? Let's assume a static page of say 100k served by IIS. Thanks. ...

asp.net mvc - static constructor

i want ask some question about asp.net mvc Is static constructor will init every user request? Is static data share for every user? ...

Why is dotnet's char.IsLower() a static method?

This seems to go against every design guideline. A static method that accepts a single argument of type T should usually just be a member method. It's so bizzare I actually had to post a StackOverflow question to understand IsUpper exists (as it didn't show up in auto-completion) Edit I understand my earlier statement needs a little e...

Should I use static data members? (C++)

Let's consider a C++ class. At the beginning of the execution I want to read a set of values from an XML file and assign them to 7 of the data members of this class. Those values do not change during the whole execution and they have to be shared by all the objects / instances of the class in question. Are static data members the most el...

Can an anonymous object be declared static in C++ ?

Is this allowed? : class A; void foo() { static A(); } I get signal 11 when I try to do it, but the following works fine: class A; void foo() { static A a; } Thank you. ...

Restricting symbols in a Linux static library

I'm looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I'd like to limit these to only those symbols that are part of the official API for the library. I already use 'static' to declare most functions as static, but this restricts them to file scope. I'm looking for a way to restrict to ...

Class (Static) Methods in VBA

I wonder, whether it is possible to create class-methods in VBA. By class-method I mean methods that can be called without having an object of the class. The 'static'-keyword does that trick in C++ and Java. In the example below, I try to create a static factory method. Example: 'Classmodule Person' Option Explicit Private m_name As S...

Static member variable in template, with multiple dlls

My code is built to multiple .dll files, and I have a template class that has a static member variable. I want the same instance of this static member variable to be available in all dlls, but it doesn't work: I see different instance (different value) in each of them. When I don't use templates, there is no problem: initialize the sta...

Static Indexers?

Why are static indexers disallowed in C#? I see no reason why they should not be allowed and furthermore they could be very useful. For example: static class ConfigurationManager { public object this[string name]{ get{ return ConfigurationManager.getProperty(name); } set { ...

How does Django serve media files?

I have set up a Django application that uses images. I think I have set up the media settings MEDIA_ROOT and MEDIA_URL correctly. However the images don't show up. Do you know what can be the problem? Let consider this example: The image files are under /home/www/media/app/photos and we are trying to request http://example.com/photos/1...

Why is accessing a static method from a non-static method bad?

Netbeans tells me it's bad to access a static method from a non static method. Why is this bad? "Accessing static method getInstance" is the warning: import java.util.Calendar; public class Clock { // Instance fields private Calendar time; /** * Constructor. Starts the clock at the current operating system time *...

Whats up with static memory in java?

This question is for the java language in particular. I understand that there is a static protion of memory set aside for all static code. My question is how is this static memory filled? Is a static object put into static memory at import, or at first reference? Also, do the same garbage collection rules apply to static objects as they...

Stack,Static and Heap in C++

I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in the heap) and what's its real advantage? What are the problems of static and stack? Could I write an entire application without allocating variables in the heap? I heard that others languages incorporate a "garbage coll...

html static page position after refresh

I have a page where I would like it to remain static after refresh and does not default back to the top page again as it will disrupt the position I was viewing it last. Hence I have all the time to scroll down again to find the area I was viewing last. Is there a way of eliminating the burden of scrolling down again? ...

What does the 'static' keyword do in Java?

To be specific, I was trying this code: package hello; public class Hello { Clock clock = new Clock(); public static void main(String args[]) { clock.sayTime(); } } But it gave an error like 'Cannot access non-static field in static method main'. So I changed the declaration of clock to this: static Clock clock ...

Java synchronized methods: lock on object or class

The Java Tutorials say: "it is not possible for two invocations of synchronized methods on the same object to interleave." What does this mean for a static method? Since a static method has no associated object, will the synchronized keyword lock on the class, instead of the object? ...

How Many Static Methods is Too Many For One Class?

UPDATE: Rephrasing the question to ask, 'are there too many' static methods (I realize that right now there are only 4 but I originally started with 2) in this class structure? If so, any suggestions on how to refactor these classes to use some sort of Finder class so that I can remove the static functions from the Model classes? I have...

using a public static class in a 'Project' with defined namespaces

In the past, I have not really used namespaces, but in this project I am using SourceSafe which requires a project, which puts everything in namespaces... In the past, I have just been able to make a public static class in the App_Code folder and access it frorm anywhere in my application, but now I cant seem to do that. For example, m...