static

[nginx] Forcing user's browser to save files to cache

My website is a online music portal with online playing system. When user play a song, it is served by nginx server on port 8080 on my server. The problem is when the song has finished playing, the player repeats the song. But every time it replays, it makes another call to server and starts downloading the file again to play. Previ...

Are static objects unique per user?

I have a .net application (c#) that goes something like this public partial class _Default : System.Web.UI.Page { #region initial variables setup private static exam theExam; #endregion protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { string userid = Request.Querystri...

Static parameters not retained across Activities

I am developing an Android app and I am using a library I wrote. This library has a class that contains some static fields. One of them is a API key. This key is used by other classes in my library to make calls on a remote service. I initialize the API key on my main Activity once when it is created and the savedInstanceState is null. ...

difference between final and static variables with reference to their use in innerclass

Hi, this is regarding final variables in inner class, but instead of declaring variable as a final if we declare variable as static out side the method ,assuming that the method is static. Then what is the difference between declaring as static outside method or final inside method to be accessed in innerclass. will they make any diffe...

Can static allocated memory become invalid during static deinitialization?

Say I have defined a variable like this (C++): static const char str[] = "Here is some string data"; And I have a statically allocated class instance which references this array in its destructor, can this go wrong? E.g. could the str variable somehow get invalid? class A { ~A() { cout << str << endl; } }; static A a; My assu...

updated static libraries, now application exits before anything on stack. How to debug

I am developing a unix console application on OS X. I just updated three statically linked libraries (hdf5 and its dependents szip and z). After a rebuild all, the application exits code 1 immediately after launch. I'm unaware of how to explore the problem further in gdb because nothing is on the stack by the time the app exits. I di...

Using static in Java singletons?

I am building a singleton service in Java for Android: final class MyService { private static Context context = null; // ... private MyService() { myObj = new MyObj(context); // ... } private static class Singleton { private static final MyService INSTANCE = new ...

How can I build Qt Application in Qt creator with static links on Windows with VS2008 runtime?

I have downloaded qt-win-opensource-4.7.0-vs2008.exe from nokia site and use it when I build my application. My application realy use VS2008 runtime not MinGW, but it has the dynamic linkage with QtCore4.dll and others Qt libs. How can I create application with static linkage with qt libs? ...

Is there a way to get one-off and/or recurring paypal/other payments with a static site?

I want to collect paypal or other payments but have my site be totally static. I want to collect a few bits of information in a text field or two. Will one of paypal's APIs let me do this and process the data manually from emails from paypal or something, or do I need to write a chunk of code to be a callback, have a database and all tha...

Using Server.MapPath() inside a static field in ASP.NET MVC

I'm building an ASP.NET MVC site where I'm using Lucene.Net for search queries. I asked a question here about how to properly structure Lucene.Net usage in an ASP.NET MVC application and was told that the best method is to declare the my IndexWriter as public static, so that it can be re-used. Here is some code that is at the top of my ...

Does it make a difference to declare a logger in all uppercase and make it final?

Is there any reason to do this: private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); instead of this? private static Logger logger = LoggerFactory.getLogger(Main.class); I don't undertstand what the syntactical benefit is of one over the other. Both seem to work fine. ...

How can I serve static content from outside of the project - rails

Without using a symlink, how can I serve images that are outside of the rails project? I though there might be some routes magic but I can find what I'm looking for... Lets say images are at ~/images and the application is at ~/app. ...

What is the right way to link to a DLL which was linked to a static library and other shared libraries?

Greetings, I hope someone has the patience to read this. I have a setup at hand, which is slightly confusing me. I have a C source code directory generated by an Eiffel Compiler. I want to use this output from Java, so I need a DLL for JNI, in which I'll implement some JNI functions. When I compile the C code, it gives me a static libr...

static properties and instances

Hi, What will happen if I create a class with a static property and create two instances of it? Will the static property will be shared between both instances and not be duplicated? Thanks, Yossi ...

difference between static_cast<const A>(*this) and static_cast<const A&>(*this)

in the following code ( taken from effective C++ ): class A { .... .... .... char& operator[](std::size_t position) // now just calls const op[] { return const_cast<char&>( // cast away const on // op[]'s return type; static_ca...

Java equivalent of the following static readonly C# code?

So, in C# one of my favorite things to do is the following: public class Foo { public static readonly Bar1 = new Foo() { SomeProperty = 5, AnotherProperty = 7 }; public int SomeProperty { get; set; } public int AnotherProperty { get; set; } } Ho...

How do I link a static C object file to Perl?

I have a function written in C (Say in HelloWorld.c file). I want to compile this and need to create a staic object file HelloWorld.a Finally I need to call this from a Perl program (HelloWorld.pl). ...

Lifetime of static variables in .NET

I have an extension method which uses some configuration settings. I've declared these as static. public static class Extensions { static string _mailServer = ConfigurationManager.AppSettings["MailServer"]; // ... etc public static void SendEmailConfirmation(this IOrder order) { } } I just wanted to check that this is...

Initializing a static const char* array

Hi, here is my question I have this in my .h file static const char *Title[]; How do I initialize the array in my .C file the array to lets say "first", "second", "third" ...

java: advantage of using static variable in java.

Hi All, Say I have two classes like this: class A{ private static Random random = new Random(); public A(){ // Do something. } public Integer methodGetsCalledQuiteOften(){ return random.nextInt(); } } class B{ private Random random; public A(){ random = new Random(...