I've started working on some Android applications and have a question regarding how people normally deal with situations where you have a static data set and have an application where that data is needed in memory as one of the standard java collections or as an array.
In my current specific issue i have a spreadsheet with some pre-calc...
Hi.
Extending methods to any instance is really easy:
public static string LeaveJustNumbers(this string text)
{
return Regex.Replace(text, @"[\D]", "");
}
...
string JustNumbers = "A5gfb343j4".LeaveJustNumber();
But what if i want to extend methods to a sealed class like string, to
work like:
string.Format("Hi:{0}","Fraga");
I...
Why so many big and little sites inserts static files ( css, images, js, ecc ) in a subdomain like media.example.com or s2.static.example.com ?
What are the advantages ?
Why not just a directory like example.com/media/ ?
...
I would like to do something like this:
public class Foo {
// Probably really a Guid, but I'm using a string here for simplicity's sake.
string Id { get; set; }
int Data { get; set; }
public Foo (int data) {
...
}
...
}
public static class FooManager {
Dictionary<string, Foo> foos = new Dictionary...
AFAIK, we can have two static variables with the same name in different functions? How are these managed by the compiler and symbol table? How are their identities managed seperately?
...
In one of my classes there is a public static String member and I need set this value in the applicationContext.xml! That is, is it possible for us to inject a value for this static property?
...
I have read Static Memory Allocation are done during Compile time.
Is the 'address allocated' used while generating executables ?
Now, I am in doubt how the memory allocation is handled when the code executable is transferred completely onto a new system.
I searched for it but I didn't get any answer on the internet.
...
I have created a pkg for my regular simple commands. They are non-static, to be more extensible, but somewhat more time-consuming to use because of creating object to use one. My other classes use them.
$ ls *.java
CpF.java IsBinary.java RmLn.java Tools.java
F2S.java IsRoot.java SaveToDisk.java WordCount.j...
Hi!
Iam fighting following problem with little success.
I want to block hotlinking to images in static folder from other domains than my_domain.com
htaccess looks like this:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?my_domain\.com [NC]
RewriteRule \.(gif|jpe?g|js|css)$ - [F,NC,L]
Rewr...
I have the following PHP code;
<?php
component_customer_init();
component_customer_go();
function component_customer_init()
{
$customer = Customer::getInstance();
$customer->set(1);
}
function component_customer_go()
{
$customer = Customer::getInstance();
$customer->get();
}
class Customer
{
public $id;
stati...
I've read that the gcc compiler can perform certain optimization when compiling an application that references a static library, for instance - it will "pull" in only that code from the static library that the application depends upon. This helps keep the size of the application's executable to a minimum if portions of the static library...
Is this the proper way to use a static const variable? In my top level class (Shape)
#ifndef SHAPE_H
#define SHAPE_H
class Shape
{
public:
static const double pi;
private:
double originX;
double originY;
};
const double Shape::pi = 3.14159265;
#endif
And then later in a class that extends Shape, I use Shape::pi. I ge...
Is there a difference between declaring a static variable outside of a function and declaring a static variable inside a function?
Also, what's the difference between declaring a variable as static and just declaring an extern variable?
...
In C static can mean either a local variable or a global function/variable without external linkage. In C++ it can also mean a per-class member variable or member function.
Is there any reference to how it happened that the static keyword that seems totally irrelevant to lack of external linkage is used to denote lack of external linkag...
I have structure defined in some header (D3DXVECTOR3)
How can I declare:
static member in the class of that type and initialize it?
maybe constant member of that type and init it?
when i use some constructor i get error only integral can be initialized.
...
As an extension the the question "Modify/view static variables while debugging in Eclipse", I'd like to be able to modify static variables while debugging in Eclipse.
For instance and local variables, I can just choose the variable in the "Variables" view of Eclipse, and use the context menu "Change value..." to change the value.
This ...
I’ve been pondering about the C# and CIL type system today and I’ve started to wonder why static classes are considered classes. There are many ways in which they are not really classes:
A “normal” class can contain non-static members, a static class can’t. In this respect, a class is more similar to a struct than it is to a static cla...
Hello folks, i am doing a class with static methods to encrypt and decrypt a message using javax.crypto. I have 2 static methods that use ecipher and dcipher in order to do what they are supossed to do i need to initialize some variables (which are static also). But when i try to use it i get InvalidKeyException with the parameters i giv...
E.g
foo1() {
static const char* str = foo2();
}
const char * foo2 () {
...
}
How does the compiler makes sure it calls foo2 just once.
...
Hi,
I have the following situation:
class Test
{
private:
class SubType
{
//...
};
static std::vector<SubType> v;
};
Because v is static, I initilize it in the cpp file with
std::vector<Test::SubType> Test::v;
But this does not work, the compiler tells me that "Test::SubType" is private.
What can I do about thi...