static

How to import static class (or static method) into IronPython (or DLR) using C# code(not python)?

scope.SetVariable("math", ?? typeof(System.Math) ??); or do I need create a module? ...

Mixed language statically linking with gfortran and gcc

Hi, I have some code written in C and Fortran that I want to compile into a statically-linked executable. If I compile the code dynamically (using the -fno-underscoring option for gfortran), it all works fine. However, I want to link it into a .so file, statically linking most of the needed libraries, and then link dynamically to libkrb5...

Create static html page using html form input

I have this html form which calls a php file . The index.html -> <form action="html_form_submit.php" method="post"> <textarea name="name" rows="2" cols="20"> </textarea > <input type="submit" value="Submit" /> </form> from html_form_submit.php -> <?php $name = @$_POST['name']; ?> <html> <body> <p> Id: <?php echo $id; ?><br> Name: <?...

When to use static modifier in PHP

Doing some code reviews lately I came across a number of classes that have significant number of static methods in them... and I can't seem to grasp why? Hence my question: What are the best practices regarding using static methods in PHP? When would one want to use them and when would one shouldn't use them? What are specific differe...

Recursive function with static variable

I have a recursive function with a static variable "count". The function increments count recursively and since it has file scope, when I call foo() a second time, count is still equal to 5. Is there a technique to reset count to 0 before the second time foo() is called? Basically, I don't want count to have file scope but I want it to ...

Pitfalls of calling static method from ASMX

Hello, I would like to know if there are any pitfalls on calling a static method from an ASP.NET web service. internal static object SelectScalar(String commandText, DataBaseEnum dataBase) { SqlConnection sqlc = new SqlConnection(AuthDbConnection.GetDatabaseConnectionString()); object returnval=null; if ...

C# Reflection - Base class static fields in Derived type

Hi, In C#, when I'm reflecting over a derived type, how come I don't see base classes' static fields? I've tried both type.GetFields(BindingFlags.Static) and type.GetFields(). Thanks ...

Do all C++ compilers allow using a static const int class member variable as an array bound?

In VC++ when I need to specify an array bound for a class member variable I do it this way: class Class { private: static const int numberOfColors = 16; COLORREF colors[numberOfColors]; }; (please don't tell me about using std::vector here) This way I have a constant that can be used as an array bound and later in the c...

Static classes in C#, what's the pros/cons?

I am programming a small game for my school assignment, the game is a simple 2D game with monsters, items and bullets. Basically you run around and tries to collect all the item coins, the monsters tries to prevent you and you can shoot them down with the bullets that you collect. Very simple. The question is, i have added the monsters,...

How do I make sure there is only 1 mutex?

Hi guys. I am running some thread safe code here. I am using a mutex to protect the section of code that needs to be run only by only 1 thread at a time. The problem I have is using this code sometimes I end up with 2 Mutex objects. This is a static function by the way. How do I make sure only 1 mutex object gets created?? /*static*/ My...

How to initial static member in c++ using function?

I am using c++; in .h: static CRITICAL_SECTION g_CS; in .cpp: CRITICAL_SECTION CQCommon::g_CS; but I want to use QGUID temp; EnterCriticalSection(&g_CS); temp = g_GUID++; LeaveCriticalSection(&g_CS); return temp; in one static function. How can I invoke InitializeCriticalSection(PCRITICAL_SECTION pcs); C...

C global static - shared among threads?

In C, declaring a variable static in the global scope makes it a global variable. Is this global variable shared among threads or is it allocated per thread? Update: If they are shared among threads, what is an easy way to make globals in a preexisting library unique to a thread/non-shared? Update2: Basically, I need to use a preexisti...

how is this a static reference?

package gui; public class Solver { void solveIt(){ CubeGui.moveThat(); } } I am trying to access method moveThat from this class, but it keeps telling me cant access non static method moveThat from a static reference. I don't see how this is a static reference? ...

Static local in class member function survives class reallocation?

class Foo { public: void bar(); }; void Foo::bar() { static int n = 0; printf("%d\n", n++); } int main(int argc, char **argv) { Foo *f = new Foo(); f->bar(); delete f; f = new Foo(); f->bar(); delete f; return 0; } Does n reset to 0 after delete'ing and new'ing the class over again? Or is n e...

java basics static method

can a static method be invoked before even a single instances of the class is constructed? ...

Where to put large static files in a tomcat project?

I have a few relatively big files (Flash movies) which I want to serve. Where should I put them inside my project? I would like not to export them each time I export the .war file, since they take up a lot of space. ...

Java: Static vs non static inner class

What is the difference between static and non static inner class? ...

Averaging a set of points on a Google Map into a smaller set

I'm displaying a small Google map on a web page using the Google Maps Static API. I have a set of 15 co-ordinates, which I'd like to represent as points on the map. Due to the map being fairly small (184 x 90 pixels) and the upper limit of 2000 characters on a Google Maps URL, I can't represent every point on the map. So instead I'd l...

Accessing Static Methods on a Generic class in c#

Hello, I have the following situation in code, which I suspect may be a bit dodgey: I have a class: abstract class DataAccessBase<T> : IDataAccess where T : AnotherAbstractClass This class DataAccessBase also has a static factory method which creates instances of derived classes of itself using an enum value in a which statement to d...

OSGI - static method calls across bundles

I have a 3rd party JAR that I have converted to an OSGI bundle using bnd. The code I need to call to use it from my own bundle looks something like this: ThirdParty.setRegKey(myRegKey); ThirdParty thirdParty = new ThirdParty(); thirdParty.callMethod(); What seems to be causing me problems is the first line - the static method call. ...