Search Results

Search found 45845 results on 1834 pages for 'static void main'.

Page 10/1834 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Static DHCP!?

    - by voyager
    I've found some home wireless routers/ADSL+ modems (ZyXEL 660) talking about Static DHCP, when refering to assosiating a specific MAC to an IP, but still serve the configuration over DHCP. Doesn't this have another name? What does Cisco call this feature (that I know supports because I've used long time ago)?

    Read the article

  • Assigning static IP to VPN server

    - by Akroy
    I have a Win2008 R2 server that is going to be receiving many VPN connections. I want to be able to staticly set the IP addresses of both ends of each connection based on the user. I easily found how to do this for the client: when you're managing the user account, go to "Dial-In" and click "Assign Static IP Addresses." Now, whenever a certain account dials in, I have control over their client VIP, but how do I set my server VIP for each account?

    Read the article

  • How to get a static ip address on adsl

    - by user23950
    I tried it before by setting the ip address manually. And I used this IP Address: 192.168.1.33 I reboot and tried if I can connect to the internet, but no luck. It must be set to obtain your ip address automatically. Is there any way on getting a static ip address on an adsl/dsl

    Read the article

  • Fix static ip address problems in Ubuntu 10.04

    - by jane
    I used Network Manager in Ubuntu 10.04 to set a static ip address and assigned one that was already in use. Now my computer will not boot (nfs crashes). I booted from a live cd to change the configuration on the file system in /etc/network/interfaces but the file looks to be the default. Where does the network manager (the gui from system- preferences) store it's configuration so I can overwrite it and enter the correct ip addresss and have a happy working computer again. thanks!!

    Read the article

  • (static initialization order?!) problems with factory pattern

    - by smerlin
    Why does following code raise an exception (in createObjects call to map::at) alternativly the code (and its output) can be viewed here intererestingly the code works as expected if the commented lines are uncommented with both microsoft and gcc compiler (see here), this even works with initMap as ordinary static variable instead of static getter. The only reason for this i can think of is that the order of initialization of the static registerHelper_ object (factory_helper_)and the std::map object (initMap) are wrong, however i cant see how that could happen, because the map object is constructed on first usage and thats in factory_helper_ constructor, so everything should be alright shouldnt it ? I am even more suprised that those doNothing() lines fix the issue, because that call to doNothing() would happen after the critical section (which currently fails) is passed anyway. EDIT: debugging showed, that without the call to factory_helper_.doNothing(), the constructor of factory_helper_ is never called. #include <iostream> #include <string> #include <map> #define FACTORY_CLASS(classtype) \ extern const char classtype##_name_[] = #classtype; \ class classtype : FactoryBase<classtype,classtype##_name_> namespace detail_ { class registerHelperBase { public: registerHelperBase(){} protected: static std::map<std::string, void * (*)(void)>& getInitMap() { static std::map<std::string, void * (*)(void)>* initMap = 0; if(!initMap) initMap= new std::map<std::string, void * (*)(void)>(); return *initMap; } }; template<class TParent, const char* ClassName> class registerHelper_ : registerHelperBase { static registerHelper_ help_; public: //void doNothing(){} registerHelper_(){ getInitMap()[std::string(ClassName)]=&TParent::factory_init_; } }; template<class TParent, const char* ClassName> registerHelper_<TParent,ClassName> registerHelper_<TParent,ClassName>::help_; } class Factory : detail_::registerHelperBase { private: Factory(); public: static void* createObject(const std::string& objclassname) { return getInitMap().at(objclassname)(); } }; template <class TClass, const char* ClassName> class FactoryBase { private: static detail_::registerHelper_<FactoryBase<TClass,ClassName>,ClassName> factory_helper_; static void* factory_init_(){ return new TClass();} public: friend class detail_::registerHelper_<FactoryBase<TClass,ClassName>,ClassName>; FactoryBase(){ //factory_helper_.doNothing(); } virtual ~FactoryBase(){}; }; template <class TClass, const char* ClassName> detail_::registerHelper_<FactoryBase<TClass,ClassName>,ClassName> FactoryBase<TClass,ClassName>::factory_helper_; FACTORY_CLASS(Test) { public: Test(){} }; int main(int argc, char** argv) { try { Test* test = (Test*) Factory::createObject("Test"); } catch(const std::exception& ex) { std::cerr << "caught std::exception: "<< ex.what() << std::endl; } #ifdef _MSC_VER system("pause"); #endif return 0; }

    Read the article

  • non-static method cannot be referenced from a static context

    - by Mith
    I am modifying the source code here: http://thinkandroid.wordpress.com/2009/12/30/getting-response-body-of-httpresponse/ I get this error: non-static method getContentCharSet(org.apache.http.HttpEntity) cannot be referenced from a static context String charset = getContentCharSet(entity); This error is line 13 on the second box. Any ideas? I have been really struggling with this code :-(

    Read the article

  • Can static methods be called using object/instance in .NET

    Ans is Yes and No   Yes in C++, Java and VB.NET No in C#   This is only compiler restriction in c#. You might see in some websites that we can break this restriction using reflection and delegates, but we can’t, according to my little research J I shall try to explain you…   Following is code sample to break this rule using reflection, it seems that it is possible to call a static method using an object, p1 using System; namespace T {     class Program     {         static void Main()         {             var p1 = new Person() { Name = "Smith" };             typeof(Person).GetMethod("TestStatMethod").Invoke(p1, new object[] { });                     }         class Person         {             public string Name { get; set; }             public static void TestStatMethod()             {                 Console.WriteLine("Hello");             }         }     } } but I do not think so this method is being called using p1 rather Type Name “Person”. I shall try to prove this… look at another example…  Test2 has been inherited from Test1. Let’s see various scenarios… Scenario1 using System; namespace T {     class Program     {         static void Main()         {             Test1 t = new Test1();            typeof(Test2).GetMethod("Method1").Invoke(t,                                  new object[] { });         }     }     class Test1     {         public static void Method1()         {             Console.WriteLine("At test1::Method1");         }     }       class Test2 : Test1     {         public static void Method1()         {             Console.WriteLine("At test1::Method2");         }     } } Output:   At test1::Method2 Scenario2         static void Main()         {             Test2 t = new Test2();            typeof(Test2).GetMethod("Method1").Invoke(t,                                          new object[] { });         }   Output:   At test1::Method2   Scenario3         static void Main()         {             Test1 t = new Test2();            typeof(Test2).GetMethod("Method1").Invoke(t,                             new object[] { });         }   Output: At test1::Method2 In all above scenarios output is same, that means, Reflection also not considering the object what you pass to Invoke method in case of static methods. It is always considering the type which you specify in typeof(). So, what is the use passing instance to “Invoke”. Let see below sample using System; namespace T {     class Program     {         static void Main()         {            typeof(Test2).GetMethod("Method1").                Invoke(null, new object[] { });         }     }       class Test1     {         public static void Method1()         {             Console.WriteLine("At test1::Method1");         }     }     class Test2 : Test1     {         public static void Method1()         {             Console.WriteLine("At test1::Method2");         }     } }   Output is   At test1::Method2   I was able to call Invoke “Method1” of Test2 without any object.  Yes, there no wonder here as Method1 is static. So we may conclude that static methods cannot be called using instances (only in c#) Why Microsoft has restricted it in C#? Ans: Really there Is no use calling static methods using objects because static methods are stateless. but still Java and C++ latest compilers allow calling static methods using instances. Java sample class Test {      public static void main(String str[])      {            Person p = new Person();            System.out.println(p.GetCount());      } }   class Person {   public static int GetCount()   {      return 100;   } }   Output          100 span.fullpost {display:none;}

    Read the article

  • Static file download from browser breaking in varnish but works fine in Apache

    - by Ron
    I would at first like to thank everyone at serverfault for this great website and I also come to this site while searching in google for various server related issues and setups. I also have an issue today and so I am posting here and hope that the seniors would help me out. I had setup a website on a dedicated server a few days ago and I used Varnish 3 as the frontend to Apache2 on a Debian Lenny server as the traffic was a bit high. There are several static file downloads of around 10-20 MB in size in the website. The website looked fine in the last few days after I setup. I was checking from a 5mbps + broadband connection and the file downloads were also completed in seconds and working fine. But today I realized that on a slow internet connection the file downloads were breaking off. When I tried to download the files from the website using a browser then it broke off after a minute or so. It kept on happening again and again and so it had nothing to do with the internet connection. The internet connection was around 512 kbps and so it was not dial up level speed too but decent speed where files should easily download though not that fast. Then I thought of trying out with the apache backend port and used the port number to check out if the problem occurs. But then on adding the apache port in the static file download url, the files got downloaded easily and did not break even once. I tried it several times to make sure that it was not a coincidence but every time I was using the apache port in the file download url then it was downloading fine while it was breaking each time with the normal link which was routed through Varnish I suppose. So, it seems Varnish has somehow resulted in the broken file downloads. Could anyone give any idea as to why it is happening and how to fix the problem. For more clarification, take this example: Apache backend set on port 8008, Varnish frontend set on port 80 Now when I download say http://mywebsite.com/directory/filename.extension Then the download breaks off after a minute or so. I cannot be sure it is due to the time or size though and I am just assuming. May be some other reason too. But when I download using: http://mywebsite.com:8008/directory/filename.extension Then the file download does not break at all and it gets download fine. So, it seems that varnish is somehow creating the file download breaking and not apache. Does anybody have any idea as to why it is happening and how can it be fixed. Any help would be highly appreciated. And my varnish default.vcl is backend apache { set backend.host = "127.0.0.1"; set backend.port = "8008"; } sub vcl_deliver { remove resp.http.X-Varnish; remove resp.http.Via; remove resp.http.Age; remove resp.http.Server; remove resp.http.X-Powered-By; }

    Read the article

  • How does GCC compile applications that reference a static library

    - by technobrat
    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 are not being used by the app. 1) Is this true? 2) How does GCC know what code from the static library the application is actually using? Does it only look t the header files that are included (directly and indirectly) in the application and then pull code accordingly? Or does it actually look at what methods from the static library are being called?

    Read the article

  • Using Static methods or none static methods in Dao Class ?

    - by dankyy1
    Hi I generate Dao classes for some DB operations in this manner making methods of Dao class as static or none static is better? Using sample dao class below ,If more than one client got to use the AddSampleItem method in same time?how this may result? public class SampleDao { static DataAcessor dataAcessor public static void AddSampleItem(object[] params) { dataAcessor =new DataAcessor(); //generate query here string query="..." dataAcessor.ExecuteQery(query); dataAcessor.Close(); } public static void UpdateSampleItem(object[] params) { dataAcessor =new DataAcessor(); //generate query here string query="..." dataAcessor.ExecuteQery(query); dataAcessor.Close(); } }

    Read the article

  • Looking for a better way to integrate a static list into a set of classes

    - by EvilTeach
    I'm trying to expand my sons interest from Warcraft 3 programming into C++ to broaden his horizons to a degree. We are planning on porting a little game that he wrote. The context goes something like this. There are Ships and Missiles, for which Ships will use Missiles and interact with them A Container exists which will hold 'a list' of ships. A Container exists which will hold 'a list' of planets. One can apply a function over all elements in the Container (for_each) Ships and Missles can be created/destroyed at any time New objects automatically insert themselves into the proper container. I cobbled a small example together to do that job, so we can talk about topics (list, templates etc) but I am not pleased with the results. #include <iostream> #include <list> using namespace std; /* Base class to hold static list in common with various object groups */ template<class T> class ObjectManager { public : ObjectManager ( void ) { cout << "Construct ObjectManager at " << this << endl; objectList.push_back(this); } virtual ~ObjectManager ( void ) { cout << "Destroy ObjectManager at " << this << endl; } void for_each ( void (*function)(T *) ) { for (objectListIter = objectList.begin(); objectListIter != objectList.end(); ++objectListIter) { (*function)((T *) *objectListIter); } } list<ObjectManager<T> *>::iterator objectListIter; static list<ObjectManager<T> *> objectList; }; /* initializer for static list */ template<class T> list<ObjectManager<T> *> ObjectManager<T>::objectList; /* A simple ship for testing */ class Ship : public ObjectManager<Ship> { public : Ship ( void ) : ObjectManager<Ship>() { cout << "Construct Ship at " << this << endl; } ~Ship ( void ) { cout << "Destroy Ship at " << this << endl; } friend ostream &operator<< ( ostream &out, const Ship &that ) { out << "I am a ship"; return out; } }; /* A simple missile for testing */ class Missile : public ObjectManager<Missile> { public : Missile ( void ) : ObjectManager<Missile>() { cout << "Construct Missile at " << this << endl; } ~Missile ( void ) { cout << "Destroy Missile at " << this << endl; } friend ostream &operator<< ( ostream &out, const Missile &that ) { out << "I am a missile"; return out; } }; /* A function suitable for the for_each function */ template <class T> void show ( T *it ) { cout << "Show: " << *it << " at " << it << endl; } int main ( void ) { /* Create dummy planets for testing */ Missile p1; Missile p2; /* Demonstrate Iterator */ p1.for_each(show); /* Create dummy ships for testing */ Ship s1; Ship s2; Ship s3; /* Demonstrate Iterator */ s1.for_each(show); return 0; } Specifically, The list is effectively embedded in each ship though the inheritance mechanism. One must have a ship, in order to access the list of ships. One must have a missile in order to be able to access the list of missiles. That feels awkward. My question boils down to "Is there a better way to do this?" Automatic object container creation Automatic object insertion Container access without requiring an object in the list to access it. I am looking for better ideas. All helpful entries get an upvote. Thanks Evil.

    Read the article

  • C++/CLI: Compiling static library with /CLR support

    - by user289770
    We have old (working) code that consists of a static library compiled with /CLR, and a C++/CLI DLL that links to the static lib. We are about to add new features to this static lib. Now, I've have heard from numerous sources that CLR static libraries are not supported by Microsoft, and therefore I'm pushing to clean this up and switch to DLL before we start adding new features to this project. However, I haven't been able to find any official information from Microsoft regarding this (say, from MSDN - other than their forums). I will appreciate any resources about this whole "static lib with CLR" issue.

    Read the article

  • Referring to this pointer in a static assert?

    - by Tyson Jacobs
    Is it possible to write a static assert referring to the 'this' pointer? I do not have c++11 available, and BOOST_STATIC_ASSERT doesn't work. struct blah { void func() {BOOST_STATIC_ASSERT(sizeof(*this));} }; Produces: error C2355: 'this' : can only be referenced inside non-static member functions error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE' In MSVC 2008. Motivation: #define CLASS_USES_SMALL_POOL() \ void __small_pool_check() {BOOST_STATIC_ASSERT(sizeof(*this) < SMALL_MALLOC_SIZE;} \ void* operator new(size_t) {return SmallMalloc();} \ void operator delete(void* p) {SmallFree(p);}

    Read the article

  • Static and overriding in Java

    - by Abhishek Jain
    public class B { static int i =1; public static int multiply(int a,int b) { return i; } public int multiply1(int a,int b) { return i; } public static void main(String args[]) { B b = new A(); System.out.println(b.multiply(5,2)); System.out.println(b.multiply1(5,2)); } } class A extends B { static int i =8; public static int multiply(int a,int b) { return 5*i; } public int multiply1(int a,int b) { return 5*i; } } Output: 1 40 Why is it so? Please explain.

    Read the article

  • Alternative to c++ static virtual methods

    - by Jaime Pardos
    In C++ is not possible to declare a static virtual function, neither cast a non-static function to a C style function pointer. Now, I have a plain ol' C SDK that uses function pointers heavily. I have to fill a structure with several function pointers. I was planning to use an abstract class with a bunch of static pure virtual methods, and redefine them in derived classes and fill the structure with them. It wasn't until then that I realized that static virtual are not allowed in C++. Is there any good alternative? The best I can think of is defining some pure virtual methods GetFuncA(), GetFuncB(),... and some static members FuncA()/FuncB() in each derived class, which would be returned by the GetFuncX(). Then a function in the abstract class would call those functions to get the pointers and fill the structure.

    Read the article

  • How to solve JavaScript origin problem with an application and static file server

    - by recipriversexclusion
    In a system that I'm building I want to serve Static files (static HTML pages and a lot of images), and Dynamic XML generated by my servlet. The dynamic XML is generated from my database (through Hibernate) and I use Restlets to serve it in response to API calls. I want to create a static file server (e.g. Apache) so that this does not interfere with the dynamic server traffic. Currently both servers need to run on the same machine. I've never done something like this before and this is where I'm stuck: The static HTML pages contain JavaScript that makes API calls to the dynamic server. However, since the two servers operate on different ports, I get stuck with the same origin problem. How can this be solved? As a bonus, if you can point me to any resources that explain how to create such a static/dynamic content serving system, I'll be happy. Thanks!

    Read the article

  • Create Generic Class Instance from Static Method in a Derived Class

    - by user343547
    I have a class in C# with a template and static method similar to class BClass<T> { public static BClass<T> Create() { return new BClass<T>(); } } From this I derive a class and specify a template parameter to the base class class DClass : BClass<int> { } A problem occurs when I try to use the static method to create an instance of D class Program { static void Main(string[] args) { DClass d = DClass.Create(); } } Gives a compiler error "Cannot implicitly convert type 'Test.BClass<int ' to 'Test.DClass'." Adding the below cast leads to a runtime casting exception. DClass d = (DClass)DClass.Create(); Is there any succint way to allow the static method to create instances of the derived class? Ideally I would like the equivalent of a c++ typedef and I don't want the below syntax (which does work). BClass<int> d = DClass.Create();

    Read the article

  • static, define, and const in C

    - by yCalleecharan
    Hi, I've read that static variables are used inside function when one doesn't want the variable value to change/initialize each time the function is called. But what about defining a variable static in the main program before "main" e.g. #include <stdio.h> static double m = 30000; int main(void) { value = m * 2 + 3; } Here the variable m has a constant value that won't get modified later in the main program. In the same line of thought what difference does it make to have these instead of using the static definition: const double m = 30000; or #define m 30000 //m or M and then making sure here to use double operations in the main code so as to convert m to the right data type. Thanks a lot...

    Read the article

  • C static variables and intialization

    - by yCalleecharan
    Hi, If I have a global static variable x like in this code #include <stdio.h> #include <stdio.h> static int x; int main(void) { DO SOMETHING WITH x HERE x++; } What will be difference if I opted to initialize x to a value first say as in static int x = 0; before entering "main"? In my first case where I didn't assign a value to x, does the compiler implicitly know that x is to be set to zero as it's a static variable? I heard that we can do this with static variables. Thanks a lot...

    Read the article

  • C++ design with static methods

    - by user231536
    I would like to define as class X with a static method: class X { static string get_type () {return "X";} //other virtual methods } I would like to force classes which inherit from X to redefine the get_type() method and return strings different from "X" (I am happy if they just redefine get_type for now). How do I do this? I know that I cannot have virtual static methods. Edit: The question is not about the type_id, but in general about a static method that should be overriden. For example class X { static int getid() {return 1;} }

    Read the article

  • GetValue on static field inside nested classes.

    - by Sir Gallahad
    Hi... I have the following class declared. I need to retreive the class structure and the static values without instanciate it. public MyClass() { public static string field = "Value"; public nestedClass() { public static string nestedField = "NestedValue"; } } I've successfuly used GetFields and GetNestedType to recover the class structure and GetValue(null) works fine on field, but not on nestedField. Let me sample: var fi = typeof(MyClass).GetField("field", BindingFlags.Public | BindingFlags.Static); var nt = typeof(MyClass).GetNestedType("nestedClass", BindingFlags.Public); var nfi = nt.GetField("nestedField", BindingFlags.Public | BindingFlags.Static); // All the above references are detected correctly var value = fi.GetValue(null); // until here everything works fine. value == "Value" var nestedValue = nfi.GetValue(null); // this one does not work!! Anyone knows why the last line does not work and how to work around? Thanks.

    Read the article

  • Setting static IP on CentOS without system-config-network

    - by Josh
    Background information: I have a problem installing system-config-network. It appears it cannot find an update to sqlite (checks every mirror and comes back empty handed.) I have tried the skipping broken option and package cleanups from yum-utils. Since I cannot get it installed, I decided to set an ip manually from console. A quick Google search comes back empty handed as for an easy how-to guide that works. What do I need to do for a currently configured DHCP ip to change it to a Static IP from console. Thanks, Josh

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >