static

What to use to save important generated data as-is? PDF/XML/DB or other?

My question is about generating invoices and receipts. The said bills use rates, names and values from a database. If the sources for generating the receipt stay unchanged, one can generate the same receipt dynamically each time. However, since names, rates and values may be changed or removed, the receipt also changes with time, i.e dya...

Putting class static members definition into cpp file -- technical limitation?

Hi, one of my "favorite" annoyance when coding in C++ is declaring some static variable in my class and then looking at compilation error about unresolved static variable (in earlier times, I was always scared as hell what does it mean). I mean classic example like: Test.h class Test { private: static int m_staticVar; int m_var; ...

using libcurl without dll

I am using Microsoft Visual C++ 2010, and I need to make an application that does not require the libcurl dll. I am defining CURL_STATICLIB in the preprocessor directives and linking to libcurl.lib, libcurl_static.lib, ws2_32.lib, and winmm.lib, but it still requires the dll to work. If I only link to libcurl_static.lib, it has undefined...

Problem with CSS, on position: absolute

Hi, I don't know what kind of position shall I announce if the parent has a position: absolute. Here's the code, <div id="new_map"> <div id="map_nbc_pop"> <div class="nm_bubbletop1"></div> <div id="nm_bubblebg"> <u...

Is it unwise to have a static method be used for security validation in ASP.net?

I have a static method like this public static string DoSomethingToString(string UntrustedString) { //parse format and change string here. return newString. } Since I know that multiple calls to: static int myInt=0; public static int AddNumber() { lock(someObject) { myInt++; } return myInt; } will return an ever increasing number (...

Retrieve only static fields declared in Java class

I have the following class: public class Test { public static int a = 0; public int b = 1; } Is it possible to use reflection to get a list of the static fields only? I'm aware I can get an array of all the fields with Test.class.getDeclaredFields(). But it seems there's no way to determine if a Field instance represents a sta...

I once read that static classes are very difficult and even impossible to debug. Is this true and why?

I once read that static classes are very difficult and even impossible to debug. Is this true and why? If an example would help, here is a PHP class I use to access a database (I don't think this is a PHP-specific question, though): <?php class DB { private static $instance; private function __construct() { } public stat...

Purpose of static keyword in array parameter of function

While browsing some source code I came across a function like this: void someFunction(char someArray[static 100]) { // do something cool here } With some experimentation it appears other qualifiers may appear there too: void someFunction(char someArray[const]) { // do something cool here } It appears that qualifiers are onl...

Static constructor for the whole assembly

I have many entry points in my assembly and I want some initialization code to be executed once per AppDomain prior to running any other code from this assembly. What would be the best way to do it? One solution I see is to have a class with static constructor and inherit every entry point I have from it. Something like this: public cl...

Are static members of generic classes shared between types

I'm trying to create a generic class which will have some static functions based on the type. Are there static members for each type? Or only where there is a generic used? The reason I ask is I want a lock object for each type, not one shared between them. So if I had class MyClass<T> where T:class { static object LockObj = new...

late static in PHP 5.3 doesn't produce expected result while inherit

I have a problem with static keyword due to inheritance in PHP 5.3. abstract class Object { protected static $_classDataSource = null; public static function getDataSource() { return static::$_classDataSource; } public static function setDataSource( $dataSource) { static::$_classDataSource = $d...

Are static members of a generic class different for different types in Java?

@Spence asked this Previous Question. So, how's that work in Java? Generic types are discarded at runtime in Java, so what happens to static variables of classes instantiated with different generic types? ...

vector with constant size

I am looking for a C++ data type similar to std::vector but without the overhead related to dynamic resizing. The size of the container will remain constant over its lifetime. I considered using boost::array, however, that is not appropriate because it requires the size of the array to be known at compile time, which is not the case in m...

Objective C static vs. dynamic constructors

Hi, Is it best to have static constructors where you alloc the instance in the constructor and you return the instance as auto release, e.g. [String stringWithFormat...] or is it best to have dynamic constructors where you ask the user to alloc first so that he is in charge of releasing? When should you use each? Cheers ...

When are inline static variables initialized in a class?

Suppose we have a class like: Public Class Question Private Shared _field as Integer = CrazyIntegersRepository.GetOne() ' Some other useful things go here End Class And the method GetOne throws an exception... How can we manage that? Is a good practice to rewrite that into a static constructor? When is the GetOne method go...

cloacking url via .htaccess

so i read stuff about how apache's mod_rewrite does the trick but it seems to be too vague for beginners like me. lets say i wanted to mask site.com/userpage.php into site.com/ or site.com/userpage or even removing the get requests.. from site.com/userpage.php?query=yes into site.com/userpage.php or site.com/userpage how can i do tha...

Way to storage object without rdbms or plain file with Java

Hello, first of all sorry for my English is not my native language. I have a web form input field and a servlet (Clustered Weblogic AS) which receives the contents of this input. I would like to limit the attempts given the same value without using rdbms or plain text file, eg // Getting value of form String input = request.getParameter...

Setting properties with reflection on static classes

I want to make a static class that would load some settings from XML file and apply those settings to its own properties. I am trying to use the following code but I don't really know what to give to the SetValue method since the class for which we want to set the property is static. // some code removed ... Type settingsType = typeof(...

Asp.Net Ajax - Call non-static method

From client side, I need to call a server method that is not static. For example, I got the following user control ucData (private instance of code-behind) that is Databind in the load event. The server method I need should return ucData.IsValid(). So it can't be static Is there a way I can do that ? ...

Unsafe to throw exceptions from statically linked C++ libraries?

I've heard that throwing exceptions in/from a C++ library could be potentially dangerous, particularly with DLLs, and particularly if the calling code and the library are compiled with different compilers. Is there any truth to this? Is it safe as long as I stick to static libraries? Note that I am not talking about internal use of excep...