With 1 good hash function, how can I create a static hash table for N distinct keys that is collision free? I know the keys in advance, so the hash table doesn't have to be resized (hence it is static).
Related question: will it always be possible to find a hash table with no collisions?
...
Hi,
in this code:
int foo() {
static int x;
}
is the x global to all threads or local in each thread? Or does that depends on a compiler flag and/or the compiler, so I cannot really know what it is from the code?
Several questions (all of them independent from compiler and compiler flags and OS):
How can I create a static varia...
Hi,
In a book there is an example about static/non-static objects.
char buf[MAX];
long count=0;
int i=0;
while(i++<=MAX)
if(buf[i]=='\0') {
buf[i]='*';
++count;
}
assert(count<=i);
It is said that sometimes the code will write past the end of the buf array into count and make the assertion to fail. And then te...
I need to know which is best book on static methods in Java.
...
Well, I am Developing a program in C++ in an Ubuntu 10.04.1 (Intel Core2Quad) LTS, but the releases are running in a Debian 5.0.5 (Intel(R) Xeon(R) CPU). Some libraries such as crypto++ or mysqlclient have different versions in both OS. So I decided to compile the binary statically with all the libraries statically compiled in the Ubuntu...
Hi there!
This question might be theoretical but i think some of the cases it makes sense.
I am just wondering about which solution is the most efficient: loading HTML templates or build up them with DOM functions?
Both has pros/cons and there's a lot of other factors that can close off any of them: For example it's obvious that DOM-co...
hi i'm developing a site you can check it from here: www.wikima4.com
and i want to have the multilingual integrate in the site. there is already a link at the upper right corner, for English, German and French.
My problem is if I click this one, the 3rd column is not changing it seems it is static. Any idea how can i have it change as...
I'm a little fuzzy on how variable access between .cpp files works. For instance:
main.cpp
int main()
{
int a = i;
return 0;
}
main2.cpp
int i;
This generates a compiler error on main.cpp, telling me there is no in i in existence. What difference then, does the "static" keyword do in this context? (I tried Googling for it,...
I have static class that has a bunch of static properties. When I try to bind the property to a BindingSource (in the UI), I can pick the static class as the DataSource, however, when I drop down the DataMember combo, there is nothing there.
Can I use a static property of a static class as a DataMember of a BindingSource?
I should men...
I haven't found a solution for the exact problem I'm having, so perhaps someone here can help me.
I've created a static archive library that uses the AVAudioPlayer class and links against the AVFoundation framework. However, when I link my app against this static library, I receive the following linker error:
Undefined symbols:
"_OBJ...
Is it a good OOP practice to have static variables to store global, changing information needed by different classes?
as opposed to passing parameters around so that it can be accessed by the called classes.
...
Why is the use of static final variables encouraged to declare constants over just final variables? The use of static sounds logical when there will be many instances of a class but is this argument correct when used for a Android activity. In fact, since the Class instance will be around even after the activity finishes and is eventuall...
If I have a class and want to have some static vars, which would be the correct way to declare them?
For example
class Foo{
public static $var1
public static $var2
public static $var3
......
}
OR
class Foo{
const $var1
const $var2
const $var3
......
}
both ways let me use Foo::var1...
Hello everyone,
Is possible make a static library with a singleton class inside? Because I try it but without success.
...
I asked a question earlier today about singletons, and I'm having some difficulties understanding some errors I encountered. I have the following code:
Timing.h
class Timing {
public:
static Timing *GetInstance();
private:
Timing();
static Timing *_singleInstance;
};
Timing.cpp
#include "Timing.h"
static Timing *Timi...
How do I declare a static class in java? eclipse wants me to remove "static" from the declaration.
static public class Constants {
...
Hey, I'm a first time write long time reader of this site.
I'm building an .NET MVC site, using ProfilBase to store a custom user object.
The profile base is stored on an database on an other server than the webserver.
I have an helper class, UserInfoHelper that contains static method to retrive username, email, telephone etc.
Right n...
Why are async callback socket methods usually static? (assume I understand static class, method and data objects). Would there be a fundamental design/logic error if one were to write a class using these as instance methods? Is there anything special that one should be careful to avoid?
...
Sample 1:
class Animal {
public static void saySomething() { System.out.print(" Gurrr!");
}
}
class Cow extends Animal {
public static void saySomething() {
System.out.print(" Moo!");
}
public static void main(String [] args) {
Animal [] animals = {new Animal(), new Cow()};
for( Animal a ...
Hey Guys,
I just have a problem that I have been trying to fix for the longest time.
I have a static library project in visual c++, and I want another project to be able to link to it. Up until now, I have simply been adding a reference to the static library project, which automatically links the library.
I want to be able to link to ...