static

Testing static classes with PHPUnit

Hi, I've got a set of classes I'm trying to test. Class A depends on Class X. Class X contains functions which do random things and things with databases. I've created a mock version of Class X which returns exactly what I want it to in order to test Class A without dependencies. So, my question is, how do I now test Class X as I've a...

Behaviour of final static method

I have been playing around with modifiers with static method and came across a weird behaviour. As we know, static methods cannot be overridden, as they are associated with class rather than instance. So if I have the below snippet, it compiles fine //Snippet 1 - Compiles fine public class A{ static void ts(){} } class B extends...

Detect stage of static initialization?

What I really want is, how do I know when each stage of C++ initialization is truly DONE? There is static initialization where simple things get assigned. Then there's dynamic static initialization where more complicated statics get assigned, which is not defined across 'translation units'. This is kind of horrible, and there are not ma...

When NOT to use the static keyword in Java?

When is it considered poor practice to use the static keyword in Java on method signatures? If a method performs a function based upon some arguments, and does not require access to fields that are not static, then wouldn't you always want these types of methods to be static? ...

java singleton pattern, should all variables be class variables?

If a class implements a singleton pattern, should all the variables be declared static? Is there any reason they shouldn't be declared static? Does it make a difference? ...

C#: Inheriting separate static members for derived classes.

My problem in brief: class A { /* Other stuff in my class*/ protected static staticMember; } class B : A { /* Other stuff in my class*/ // Will have A.staticMember but I want B.staticMember (same type) } class C : A { /* Other stuff in my class*/ // Will have A.staticMember but I want C.staticMember (same type) } ...

Moq Roles.AddUserToRole test

I am writing unit tests for a project in ASP.NET MVC 1.0 using Moq and MvcContrib TestHelper classes. I have run into a problem. When I come to Roles.AddUserToRole in my AccountController, I get a System.NotSupportedException. The Roles class is static and Moq cannot mock a static class. What can I do? ...

Force library linking with Qt and google test

Hi, I'm trying to write a test suit for my Qt(c++) application using google test, the main problem is that my application consists of one main program and various shared libs. Everything was working just fine, until I tried to do some code coverage using gcov/lcov (which don't operate on dynamic libs), so I modified all my .pro file to ...

Thread local storage used anywhere else?

Is thread local storage used anywhere else other than making global and static variables local to a thread?Is it useful in any new code that we write? ...

static - used only for limiting scope?

Is the static keyword in C used only for limiting the scope of a variable to a single file? I need to know if I understood this right. Please assume the following 3 files, file1.c int a; file2.c int b; file3.c static int c; Now, if the 3 files are compiled together, then the variables "a" & "b" should have a global scope and ...

Why can't static classes have destructors?

Two parts to this: If a static class can have a static constructor, why can't it have a static destructor? What is the best workaround? I have a static class that manages a pool of connections that are COM objects, and I need to make sure their connections get closed/released if something blows up elsewhere in the program. ...

How to include resources in iphone static library ?

I'd like to include files, data and images in a static library API so the users won't need to include them manually in their project. I see that there isn't obvious way to do it but is there some hack or workaround to achieve this goal ? Thanks ...

Anyone has an alternative to using static methods in a C# interface?

I want to implement a collection, whose items need to be tested for emptiness. In case of a reference type, one would test for being null. For value types, one has to implement empty testing, and probably choose a specific value that represents emptyness. My generic collection of T should be usable for both value and reference type valu...

Static text within text field?

How can i keep static text within a <input type="text" name="site"> text field, just like the tumblr account ***.tumblr.com here > http://www.tumblr.com/ ...

Thought I understood static classes

Trying to construct a helper class that will return an arraylist, but I'm getting the following error, having to do with the xml document I need to create: Util.oDocument': cannot declare instance members in a static class I think I understand why you wouldn't want to create a new xmldoc object each time this method gets called, bu...

Static fields question

im trying to understand the get and set properties for fields, and run in to this issue, can somone explaine to me why i had to make the int X field Static to make this work? using System; namespace ConsoleApplication1 { class Program { public static int X = 30; public static void Main() { va...

Nginx location, alias, rewrite, root

I'm serving /foo/bar/ by way of proxypass and want to continue doing so. However, I would like to serve /foo/bar/baz.swf statically from say /var/www/mystatic/baz.swf and so forth. I was hoping that I could do something like location /foo/bar/(.*) { alias /var/www/mystatic/; } location / { proxy_pass ....; ...

C++ static virtual members?

Is it possible in C++ to have a member function that is both static and virtual? Apperantly, there isn't a straight-forward way to do it (static virtual member(); is a complie error), but at least a way to acheive the same effect? I.E: struct Object { struct TypeInformation; static virtual const TypeInformation &GetTypeInfor...

Is there a Static Constrctors/Destructors Help topic

I know in D2010 they have added support for static constructors and destructors. Where I can find more information about they: syntax and samples? ...

Django on Webfaction: Serving static admin media files - configuration

hi folks, I having trouble serving Django's static admin files on webfaction. Here's how I'm currently set up: I've created a 'Symbolic link to static-only app', and provided the link to Django admin files in 'extra info': /home/myusername/webapps/mydjangoapp/lib/python2.5/django/contrib/admin/media (cd'ing into that directory works ...