Search Results

Search found 20383 results on 816 pages for 'hello'.

Page 55/816 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Problem separating C++ code in header, inline functions and code.

    - by YuppieNetworking
    Hello all, I have the simplest code that I want to separate in three files: Header file: class and struct declarations. No implementations at all. Inline functions file: implementation of inline methods in header. Code file: normal C++ code for more complicated implementations. When I was about to implement an operator[] method, I couldn't manage to compile it. Here is a minimal example that shows the same problem: Header (myclass.h): #ifndef _MYCLASS_H_ #define _MYCLASS_H_ class MyClass { public: MyClass(const int n); virtual ~MyClass(); double& operator[](const int i); double operator[](const int i) const; void someBigMethod(); private: double* arr; }; #endif /* _MYCLASS_H_ */ Inline functions (myclass-inl.h): #include "myclass.h" inline double& MyClass::operator[](const int i) { return arr[i]; } inline double MyClass::operator[](const int i) const { return arr[i]; } Code (myclass.cpp): #include "myclass.h" #include "myclass-inl.h" #include <iostream> inline MyClass::MyClass(const int n) { arr = new double[n]; } inline MyClass::~MyClass() { delete[] arr; } void MyClass::someBigMethod() { std::cout << "Hello big method that is not inlined" << std::endl; } And finally, a main to test it all: #include "myclass.h" #include <iostream> using namespace std; int main(int argc, char *argv[]) { MyClass m(123); double x = m[1]; m[1] = 1234; cout << "m[1]=" << m[1] << endl; x = x + 1; return 0; } void nothing() { cout << "hello world" << endl; } When I compile it, it says: main.cpp:(.text+0x1b): undefined reference to 'MyClass::MyClass(int)' main.cpp:(.text+0x2f): undefined reference to 'MyClass::operator[](int)' main.cpp:(.text+0x49): undefined reference to 'MyClass::operator[](int)' main.cpp:(.text+0x65): undefined reference to 'MyClass::operator[](int)' However, when I move the main method to the MyClass.cpp file, it works. Could you guys help me spot the problem? Thank you.

    Read the article

  • JavaScript Namespace Declaration

    - by Hery
    I created a javascript class as follow: var MyClass = (function() { function myprivate(param) { console.log(param); } return { MyPublic : function(param) { myprivate(param); } }; })(); MyClass.MyPublic("hello"); The code above is working, but my question is, how if I want to introduce namespace to that class. Basically I want to be able to call the class like this: Namespace.MyClass.MyPublic("Hello World"); If I added Namespace.MyClass, it'll throw error "Syntax Error". I did try to add "window.Namespace = {}" and it doesn't work either. Thanks.. :)

    Read the article

  • How to begin writing an Application Server over Apache?

    - by Cracker
    For my college project, I want to create a simple application server in C that runs over Apache. Like .php, .asp, .jsp, the extension of my files would be .sas. I have already written a parser which reads the .sas files and generates the output. For example, consider a file index.sas with the below code: <% echo "Hello"; %> Now, if I execute: sas index.sas The result would be: Hello Now I want to use this program as an application server over Apache just as PHP, Tomcat, etc. work over Apache. I have heard of cgi-bin but I think PHP uses a different approach. I want to learn the approach which PHP uses. Please advice.

    Read the article

  • Parenthesis operator in C. What is the effect in the following code

    - by Andre
    Hi everyone, I was playing with a macro to enable/disable traces when I came out with the following code when the macro is disabled: int main { ("Hello world"); } This code is valid and I got the desired effect (nothing happens when the macro is disabled) but I couldn't figure out what exactly is happening. Is the compiler seeing the parenthesis as a "nameless" method declaration? To make it clearer the code is : #ifdef TRACE #define trace printf("%s %d -> ",__FILE__, __LINE__);printf else #define trace #endif int main { trace("Hello world"); } Thanks in advance.

    Read the article

  • Why doesn't C# allow for global inferred types i.e. using var?

    - by BritishDeveloper
    I know it can't be done since using var can only be done for local variables. I'm just wondering if anyone has a theory why the C# team thought this should be so. e.g. what would be wrong with this: public class SomeClass { var someString = "hello"; //not cool public SomeClass() { var someOtherString = "hello"; //cool } } If someString is initialised then it is obviously a string just like someOtherString. Why is there one rule for local variables and another for globals?

    Read the article

  • Difference between static const char* and const char*.

    - by Will MacDonagh
    Could someone please explain the difference in how the 2 snippets of code are handled below? They definitely compile to different assembly code, but I'm trying to understand how the code might act differently. I understand that string literals are thrown into read only memory and are effectively static, but how does that differ from the explicit static below? struct Obj1 { void Foo() { const char* str( "hello" ); } }; and struct Obj2 { void Bar() { static const char* str( "hello" ); } };

    Read the article

  • Iterating through same form elements

    - by Hulk
    If a form has same tag repeatedly. How to get its value in javascript. <script> function validate() { //get all values of elmone } </script> <form> <input type="text" size="15" value="Hello World" name="elmOne"> <input type="text" size="15" value="next Hello World" name="elmOne"> <input type="button" onclick="javascript:validate()" value="validate"> </form> Thanks..

    Read the article

  • Recursive compilation using gcc

    - by curiousexplorer
    I am using the gcc compiler. My project source tree looks like somewhat like this test$~: tree . . |-- folder | |-- hello.cpp | `-- hello.h `-- main.cpp 1 directory, 3 files test$~: The file main.cpp contains the main() function and all the functions invoked by main.cpp lie in the directory named folder So far in all my little projects I never had to put some source code under a sub-directory. What I am looking for, in short, is some gcc command for recursive compilation in sub-directories and their subdirectories and so on... This command should be invoked from the home directory of the code project.

    Read the article

  • BASH SHELL IF ELSE run command in background

    - by bikerben
    I have used the & command before to make a script run another script in the background like so: #!/bin/bash echo "Hello World" script1.sh & script2.sh & echo "Please wait..." But lets say I have another script with an IF ELSE statment and I would like to set an ELIF statement mid flow as a background task witht the & and then carry on with processing the rest of my script knowing that while rest of the ELIF will carry running in the back ground: #!/bin/bash if cond1; then stuff sleep 10 & stuff stuff elif cond2; then something else else echo "foo" fi stuff echo "Hello World" I really hope this makes sense any help would be greatly appreciated.

    Read the article

  • Java: how to have global values inside a class?

    - by HH
    I want less methods. I want a common global TestClass from which I could use any of its value inside the class. import java.util.*; import java.io.*; public class TestClass { TestClass(String hello){ String hallo = hello; String halloSecond = "Saluto!"; } public static void main(String[] args) { TestClass test = new TestClass("Tjena!"); System.out.println("I want "Tjena!": " + test.hallo); TestClass testSecond = new TestClass("1"); System.out.println("I want Saluto!:" + test.halloSecond); System.out.println("I want Saluto!:" + testSecond.halloSecond); // How can I get glob.vars like the "Saluto!"? } }

    Read the article

  • C++ conditional compilation

    - by Shaown
    I have the following code snippet #ifdef DO_LOG #define log(p) record(p) #else #define log(p) #endif void record(char *data){ ..... ..... } Now if I call log("hello world") in my code and DO_LOG isn't defined, will the line be compiled, in other words will it eat up the memory for the string "hello world"? P.S. There are a lot of record calls in the program and it is memory sensitive, so is there any other way to conditionally compile so that it only depends on the #define DO_LOG? Thanks in advance.

    Read the article

  • PHP/MySQL Database Issues

    - by queryne
    PHP/MySQL newbie question. I have a database I've imported into my local phpmyadmin. However it seems I can't access it from my a php application. The connection string seems right and when I try to authenticate user credentials to access database information, no problems. However authenticate everyone and knows when I put in fake credentials. Still it won't pull any other information from the database. For instance, once a users login they should see something like, "Hello username", that kind of thing. At this point I see "Hello" without the username. Any ideas what i might be missing?

    Read the article

  • tuProlog unknow behavior

    - by Josh Guzman
    I'm using tuProlog to integrate Prolog with Java, to do so I'v been defined a .pl file wich contains this code: go:-write('hello world!'),nl. In my Java File at NetBeans i Have a Main Class that invokes this: Prolog engine = new Prolog(); Theory theory = new Theory(new FileInputStream("facultad.pl")); try { engine.setTheory(theory); } catch (InvalidTheoryException ex) { } SolveInfo solution = engine.solve("go."); if (solution.isSuccess()) { System.out.println(solution.getSolution()); } This Code must returns 'hello world', but instead of that it answer 'go', any ideas about this erratic behavior ??

    Read the article

  • Python:How to override inner class methods if the inner class is defined as a property of the top cl

    - by Maddy
    I have a code snippet like this class A(object): class b: def print_hello(self): print "Hello world" b = property(b) And I want to override the inner class 'b'(please dont worry about the lowercase name) behaviour. Say, I want to add a new method or I want to change an existing method, like: class C(A): class b(A.b): def print_hello(self): print "Inner Class: Hello world" b = property(b) Now if I create C's object as c = C(), and call c.b I get TypeError: 'property' object is not callable error. How would I get pass this and call print_hello of the extended inner class? Disclaimer: I dont want to change the code for A class.

    Read the article

  • XML XHR Request resultin in 0 stauts and empty response text.

    - by deepak
    I had another post for the same problem... I think I put the question in a wrong way.. Let me give more details: i have test.html in my c:\ drive and I have a local webserver runnin in qt, and i have some plugin written to that webserver which will get the request and send some response text "hello". in test.html i m making a xml xhr request which will make a GET request like localhost:8080/test which will return the text "hello" by that plugin. Now if I directly open test.html from C:\ it doesnt work, i mean i get response 4 and status 0, and response text nothing.. but the request is passing through webserver and plugin It works fine, when the test.html is put in the webserver pages directory.

    Read the article

  • How to split up a long list using \n

    - by pypy
    Here is a long string that I convert to a list so I can manipulate it, and then join it back together. I am having some trouble being able to have an iterator go through the list and when the iterator reach, let us say every 5th object, it should insert a '\n' right there. Here is an example: string = "Hello my name is Josh I like pizza and python I need this string to be really really long" string = string.split() # do the magic here string = ' '.join(string) print(string) Output: Hello my name is Josh I like pizza and python I need this string to be really really long Any idea how i can achieve this? I tried using: for words in string: if words % 5 == 0: string.append('\n') but it doesn't work. What am I missing?

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >