Search Results

Search found 263 results on 11 pages for 'bruce tierney'.

Page 7/11 | < Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >

  • Why does double dispatch not work in C++?

    - by Bruce
    #include<iostream.h> #include<conio.h> using namespace std; class SpaceShip {}; class GiantSpaceShip : public SpaceShip {}; class Asteroid { public: virtual void CollideWith(SpaceShip *) { cout << "Asteroid hit a SpaceShip" << endl; } virtual void CollideWith(GiantSpaceShip *) { cout << "Asteroid hit a GiantSpaceShip" << endl; } }; class ExplodingAsteroid : public Asteroid { public: virtual void CollideWith(SpaceShip *) { cout << "ExplodingAsteroid hit a SpaceShip" << endl; } virtual void CollideWith(GiantSpaceShip *) { cout << "ExplodingAsteroid hit a GiantSpaceShip" << endl; } }; int main() { SpaceShip * s = new GiantSpaceShip(); Asteroid * a = new ExplodingAsteroid(); a->CollideWith(s); getch(); return 0; } How can I enable double dispatch in C++?

    Read the article

  • How to do an if statement on a function in PHP?

    - by Bruce
    I just realized that you can't just use an if statement on a function, for example this doesn't work: function sayHello() { echo "Hello World"; } if(sayHello()) echo "Function Worked"; else echo "Function Failed"; I also saw that a function can't be put as the value of a variable. So how can I do an if statement to check if a function has executed properly and display it to the browser?

    Read the article

  • ASP.Net Reportviewer in folder not working

    - by Bruce
    We can run the ReportViewer in a ASP.Net Web App project that is off the root OK so localhost/test/report.aspx works. It's running as a Client Report. But if we move the application up another level the report stops working so localhost/testfolder/test/test.aspx. When the report fails it has no data to display and none of the images are loading. Info: We are bind the report in code and sort out the Report.LocalReport.ReportPath to the correct path. Can't help thinking there is a setting wrong, but stumped at the moment!

    Read the article

  • How to find the jmp address during a x86 function call?

    - by Bruce
    Suppose we have a call foo statement. So when the assembler encounters a call statement it breaks it down into - push ip + 6 jmp <addr of foo> I have the return address in a register ebx. Now I want to find out the "addr of foo". How do I do it? I want to confirm that the push statement is present before the jmp. Will the memory map look something like this? ------- push (what will be the value stored in this byte?? opcode ??) ------- jmp (what will be the value stored in this byte?? opcode ??) ------- jmp byte 1 ------- jmp byte 2 ------- jmp byte 3 ------- jmp byte 4 ------- return address stored in ebx ------- What are the opcodes for push and jmp?

    Read the article

  • Best C++ development environment in Linux

    - by Bruce
    I have some experience with Eclipse and Qt creator and am somewhat disappointed in their debuggers, less so in their editors. On Windows, I like Visual Studio for debugging and SlickEdit for editing (SE is also available on Linux). Is there an IDE that is somehow better than the two mentioned?

    Read the article

  • What's the best way to avoid try...catch...finally... in my unit tests?

    - by Bruce Li
    I'm writing many unit tests in VS 2010 with Microsoft Test. In each test class I have many test methods similar to below: [TestMethod] public void This_is_a_Test() { try { // do some test here // assert } catch (Exception ex) { // test failed, log error message in my log file and make the test fail } finally { // do some cleanup with different parameters } } When each test method looks like this I fell it's kind of ugly. But so far I haven't found a good solution to make my test code more clean, especially the cleanup code in the finally block. Could someone here give me some advices on this? Thanks in advance.

    Read the article

  • Question about CALL statement

    - by Bruce
    I have the following code in VC++ Func5(){ StackWalk(); } Func4{ Func5();} I am a Beginner in x86 Assembly Language. I am trying to find out the starting address of Func5(). I get the Func5()'s return address from its stack frame. Now before this return address there should be a CALL statement. So I extract out the bytes before the return address. Sometimes it's a near call like E8 ff ff ff d8. So for this statement I subtract the offset 0x28 from the function's return address to get Func5()'s base address (where it resides in memory). The problem is I don't know how to calculate this for a indirect NEAR call. I have been trying to find out how to do it for some time now. So I have extracted out the first 5 bytes before the return address and they are ff 75 08 ff d2 I think this stands for CALL ECX (ff d2) but I am not sure. I will be very grateful if someone can tell me what kind of CALL statement this is and how I can calculate the function's base address from this kind of call.

    Read the article

  • How to execute maven tasks in eclipse (Sonatype plugin)

    - by Bruce
    Hi all I know it must be something simple, but I just can't figure it out.. I'm using the Sonatype maven plugin on eclipse. When I want to build a war file for a webapp project, the only way I know to do it is to use the command line and type mvn package. I've looked all through the right click menu and I can't find any way to do it from eclipse. There's a maven submenu that seems to have no options to do with building, and there's a run menu that doesn't seem right - I don't want to run my project - I just want to build it. There is a maven build option in the run menu, but if I run it, a configuration window pops up for me to enter goals in.. How I do I just do a simple mvn package, but through gui? What am I missing? Thanks!

    Read the article

  • Problem generating GET url

    - by Bruce
    I am working on Java. I am calling a GET url on my own machine using Java. Here is the url string with the arguments. listen.executeUrl("http://localhost/post_message.php?query_string="+str); I am taking str as user input. BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter query: "); str = br.readLine(); How do I encode str into GET argument. For eg. str -> test query url -> http://localhost/post_message.php?query_string=test%20query

    Read the article

  • Writing bash script for X-11 forwarding

    - by Bruce
    I was having problem with SSH X-11 forwarding while I used sudo. I found a solution for it. $hostname server4.a.b.edu First I do: $ echo $DISPLAY localhost:10.0 then $ xauth list server1.a.b.edu/unix:12 MIT-MAGIC-COOKIE-1 6026864294a0e081ac452e8740bcd0fe server4.a.b.edu/unix:10 MIT-MAGIC-COOKIE-1 f01fbfe0c0d68e30b45afe3829b27e58 Then I need to do $ sudo xauth add server4.a.b.edu/unix:10 MIT-MAGIC-COOKIE-1 f01fbfe0c0d68e30b45afe3829b27e58 for sudo to work, for the cookie with my server name and display. How do I write a bash script to automate this?

    Read the article

  • newbie hibernate first level cache confusion

    - by Bruce
    Hi all I'm just geting to grips with hibernate. Little bit confused. I just wanted to watch the operation of the first level cache, which I understood to batch up queries until the end of the session. But if I create an object, hibernate saves it immediately, so that when I later update it in the same transaction, it has to do an update too: Session session = factory.getCurrentSession(); session.beginTransaction(); Test1 test1 = new Test1(); test1.setName("Test 1"); test1.setValue(10); // Touch it session.save(test1); System.out.println("At checkpoint 1"); test1.setValue(20); session.getTransaction().commit(); I see the sql for the save, then 'At checkpoint 1', then the sql for the update. Do I have something set up wrong or am I misunderstanding hibernate's first level cache? Is there a good document on the first level cache - I didn't find anything in the hibernate docs, but I could easily have missed it.. Thanks!

    Read the article

  • Question about inserting assembly code in C++

    - by Bruce
    I am working on VC++ compiler. I want to accomplish the following The variables s.AddrFrame.Offset and s.AddrStack.Offset contain the value of EBP and ESP respectively. I want to extract the value of old EBP and the return address. Assuming the address EBP + 1 contains the old 32 bit EBP value and EBP + 5 the return address I wrote the following code: unsigned int old_ebp = 0; unsigned int ret_addr = 0; __asm{ mov old_ebp, DWORD PTR [s.AddrFrame.Offset + 1] mov ret_addr, DWORD PTR [s.AddrStack.Offset + 5] } But this is not compiling xxxx.cpp(1130) : error C2415: improper operand type Please Help

    Read the article

  • Releasing from development into production in maven

    - by Bruce
    Hi all, I'm confused about the use of maven in development and production environments - I'm sure it's something simple that I'm missing. Grateful for any help.. I set up maven inside eclipse on my local machine and wrote some software. I really like how it's made things like including dependent jars very easy. So that's my development environment. But now I want to release the project to production on a remote server. I've searched the documentation, but I can't figure out how it's supposed to work or what the maven best practice is.. Are you supposed to: a) Also be running maven on your production environment, and upload all your files to your production environment and rebuild your project there? (Something in me baulks at the idea of rebuilding 'released' code on the production server, so I'm fairly sure this isn't right..) b) use mvn:package to create your jar file and then copy that up to production? (But then what of all those nice dependencies? Isn't there a danger that your tested code is now going to be running against different versions of the dependent jars in the production environment, possibly breaking your code? Or missing a jar..?) c) Something else that I'm not figuring out.. Thanks in advance for any help!

    Read the article

  • Maven release prepare without prompts?

    - by Bruce Settergren
    I want to automate the execution of Maven release:prepare with Perl so that the user doesn't have to answer the prompts for version names etc. Are there a -D arguments that can be supplied so that no prompting is done? I tried the obvious solution which is to feed the prompt answers to mvn via perl code like this: my $cmd = qq(mvn release:prepare -DautoVersionSubmodules=true-DpreparationGoals="clean install"); open MVN, "| $cmd"; print MVN "\n"; # default print MVN "$cur_version"; print MVN "\n"; print MVN "$next_version"; print MVN "\n"; close MVN; but mvn ignores such input and winds up using the defaults (and doesn't prompt either). So, are there -D args for the release:prepare plugin:goal? Thanks.

    Read the article

  • When [script] file download fails, how can I tell why?

    - by Bruce
    My web application sends me diagnostic info from the browser javascript telling me that a [script] tag I've injected has failed to download the associated .js file. I can't reproduce this locally, and there is no particular pattern to which file fails, or what the browser type is. There is a pattern to the geo location of the requests - Mexico and Brazil are always more frequent - so I'm guessing that perhaps the internet in general is just more flaky there, and it is just network issues causing the failures. I'd really like to know for sure, though. Is there any way to determine, from the browser javascript, whether the failure occurred because of an error returned by the server, from a network error, or from a protocol timeout? I don't care if the mechanism is browser-specific, since it seems likely that the same issue is causing the error on all browser types.

    Read the article

  • How to fetch a random record from SQLite database?

    - by Bruce
    I am working on PHP. I was working with MySQL before. Here is the code I used - $offset_result = mysqli_query($con, " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM students "); $offset_row = mysqli_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysqli_query($con, " SELECT name FROM students LIMIT $offset, 1 " ); $row = mysqli_fetch_row($result); mysqli_free_result($result); What will be the corresponding set of statements for SQLite?

    Read the article

  • Is Ruby on Rails suitable for a non-web application?

    - by Bruce
    I am interested in developing a workstation-based application that communicates with a proprietary data server and that presents information from that server to the user. I am not intending the user interface to be browser-based, and have been considering Qt as my framework. Should I consider RoR for this? Thanks.

    Read the article

  • mvn clean install using java 1.5 or 1.6

    - by bruce
    When I do mvn clean install, I get this error: annotations are not supported in -source 1.3 (try -source 1.5 to enable annotations) But where do I put this -source 1.5 command? I tried all permutations with mvn clean install and couldn't get it to work. So I tried putting compilation in my pom, like this: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> But that didn't work either.. What am I missing? Thanks!

    Read the article

  • Does (size_t)((char *)0) ever not evaluate to 0?

    - by Bruce Christensen
    According to the responses in "Why subtract null pointer in offsetof()?" (and my reading of K&R), the C standard doesn't require that (size_t)((char *)0) == 0. Still, I've never seen a situation where casting a null pointer to an integer type evaluates to anything else. If there is a compiler or scenario where (size_t)((char *)0) != 0, what is it?

    Read the article

  • Regarding C typedef struct

    - by Bruce Duncan
    I have multiple instances of typedef struct box so box box1, box box2 etc. The members of the struct are length, width, height etc. typedef struct { int width; int height; } box; box box1; box box2; How can I create a function that operates on all the width members of each box instance? My confusion is how do I pass a pointer to a typedef struct member that works across all instances of box. I know how to pass a pointer to a specific instance member like box1.width but how to pass .width and then do box1.width=value; box2.width=value; box3.width=value; within the function?

    Read the article

  • Capture variable assignments in a Perl eval

    - by Bruce
    I would like to be able to capture variable assignments from a Perl eval. That is, to determine what variable names have been assigned to within the code and extract their value. For example if I run: eval '$foo=42; $bar=3.14;' The result of the eval is 3.14 (the last value evaluated), but I would also like to be able to determine the names "$foo" and "$bar" and their values (without knowing the names in advance). I have read up on a couple of ways of inserting variables into the eval block, through Safe and Eval::Context, but not yet any way of extracting them. I am more familiar with Python's eval/exec which have built in support for this.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >