Search Results

Search found 479 results on 20 pages for 'ron bruce'.

Page 13/20 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • When is factory method better than simple factory and vice versa?

    - by Bruce
    Hi all Working my way through the Head First Design Patterns book. I believe I understand the simple factory and the factory method, but I'm having trouble seeing what advantages factory method brings over simple factory. If an object A uses a simple factory to create its B objects, then clients can create it like this: A a = new A(new BFactory()); whereas if an object uses a factory method, a client can create it like this: A a = new ConcreteA(); // ConcreteA contains a method for instantiating the same Bs that the BFactory above creates, with the method hardwired into the subclass of A, ConcreteA. So in the case of the simple factory, clients compose A with a B factory, whereas with the factory method, the client chooses the appropriate subclass for the types of B it wants. There really doesn't seem to be much to choose between them. Either you have to choose which BFactory you want to compose A with, or you have to choose the right subclass of A to give you the Bs. Under what circumstances is one better than the other? Thanks all!

    Read the article

  • What are the major differences between Windows CE and Windows Mobile for a programmer?

    - by Brad Bruce
    What are the major differences between Windows CE and Windows Mobile for a programmer? I'd love to find a feature table, but haven't been able to find one on the Microsoft web site. I'm starting to work on a project involving industrial handheld terminals. I'm early into the design phase and need to find a comparison of Windows CE and Windows Mobile. Many of the people I'll be talking to jump on the first option that sounds "good enough". I want my first suggestion to be the best based on their needs. We're talking heavy duty hardware with a heavy duty price. I've got to get the programming questions out of the way early. We're currently a MFC6 and .Net 2.0 shop

    Read the article

  • PHP array value becomes blank. What is going on?

    - by Michael Bruce
    I have written a web page that works fine expect for some weird behavior. The code below gets all expected values and populates them correctly except for $v-data["quick_phone_id"] and $v-data["quick_email_id"] which are integers. Those values come out blank in the string I am creating. The value for $v-data["id"] is another integer and works as expected. My only clue is that when I uncomment the commented out line, the code works properly. So I'm guessing this has to do with referencing getting broken for the array. Any ideas? I'd like to fix my code and my PHP knowledge. $contacts = ContactInfo::loadMyContacts($userId); $sb = new StringBuilder(); $idx = 0; //$vals = "vals: ".$contacts[0]->data["quick_phone_id"]; $sb->append(' dataRows = ['); foreach($contacts as $k => $v) { $sb->append('{ id:"'.strval($v->data["id"]).'",'); $sb->append('url:"edit_contact.php?id='.$v->data["id"].'",'); $sb->append('gname:"'.$v->data["given_name"].'",'); $sb->append('fname:"'.$v->data["family_name"].'",'); $sb->append('phone1id2:"'.strval($v->data["quick_phone_id"]).'",'); $sb->append('phone1type:"'.$v->data["quick_phone_type"].'",'); $sb->append('phone1:"'.$v->data["quick_phone"].'",'); $sb->append("email1id2:'".strval($v->data["quick_email_id"])."',"); $sb->append('email1type:"'.$v->data["quick_email_type"].'",'); $sb->append("email1:'".$v->data["quick_email"]."',"); $sb->append("dirty:false },\n"); } $sb->append('];');

    Read the article

  • How to append text to a text file in WinAPI?

    - by Bruce
    Hi guys, Ive got an annoying problem, I cant append any text to the text file. Every time I open it for writing, I overwrite the data. I tried to move the file pointer to the end of the file, but no result (no writing to the file at all). Here is the code: INVOKE CreateFile, offset filePath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 mov hFile, eax mov edx, 10 INVOKE SetFilePointer, hFile, 0, 0, FILE_END INVOKE WriteFile, hFile, offset buffer, edx, ADDR SizeReadWrite, NULL INVOKE CloseHandle, hFile Any ideas? Thank you in advance!

    Read the article

  • how to log digester with apache commons?

    - by Bruce
    Hi all I'm having trouble getting digester to log anything. I'd be hugely grateful for any light anyone can shed. In my code I'm doing this: Digester digester = new Digester(); .. some digester set up stuff // What on earth should go in here???? digester.setLogger(LogFactory.getLog("org.apache.commons.logging.Log")); I have a commons-logging.properties file in my classpath as follows: org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester=debug org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax=info I just get no debug info at all.. Thanks for your help!

    Read the article

  • How to rotate an image properly in JPanel (Java)

    - by Bruce
    Hi guys, I'm working on rotating a loaded image. I set the graphics on a JPanel and then use standard AffineTransform in order to rotate it, say, 45 degrees. Unfortunately, the image is being cut, if it exceeds the panel area. How may I force JPanel to add scrolls to itself (while loading an image file, I would like to adjust the size of JPanel by adding the scrolls, without adjusting the size of JFrame). Or, in other words, how to correctly rotate the whole image? Thank you in advance for the reply!

    Read the article

  • Loading Java applet from WEB-INF/classes by JSP

    - by Bruce
    Hi guys, Ive got a problem with loading an applet from WEB-INF/classes directory. The main class of an applet (MainApplet.class) is there in the package aaa, but when loading I got the exception java.lang.ClassNotFoundException. Where am I wrong? My jsp is in Web Pages dir. < jsp:plugin type="applet" code="aaa/MainApplet.class" jreversion="1.6" width="700" height="500" Thanks in advance for the reply!

    Read the article

  • Convert Java String to Array

    - by Bruce
    This is a weird problem. Here is my code String reply = listen.executeUrl("http://localhost:8080/JavaBridge/reply.php); executeUrl returns as String object whatever is returned by the reply.php file. Now comes the problem. In reply.php I am returning an PHP array and reply is a String. When I do System.out.println("Reply = "+reply); I get Reply = array(2) { [0]=> string(14) "Dushyant Arora" [1]=> string(19 ) "@dushyantarora13 hi"} But reply is still a String. How do I convert it into a String array or an Array.

    Read the article

  • Dealing with infinite loops when constructing states for LR(1) parsing

    - by Bruce
    I'm currently constructing LR(1) states from the following grammar. S->AS S->c A->aA A->b where A,S are nonterminals and a,b,c are terminals. This is the construction of I0 I0: S' -> .S, epsilon --------------- S -> .AS, epsilon S -> .c, epsilon --------------- S -> .AS, a S -> .c, c A -> .aA, a A -> .b, b And I1. From S, I1: S' -> S., epsilon //DONE And so on. But when I get to constructing I4... From a, I4: A -> a.A, a ----------- A -> .aA, a A -> .b, b The problem is A - .aA When I attempt to construct the next state from a, I'm going to once again get the exact same content of I4, and this continues infinitely. A similar loop occurs with S -> .AS So, what am I doing wrong? There has to be some detail that I'm missing, but I've browsed my notes and my book and either can't find or just don't understand what's wrong here. Any help?

    Read the article

  • 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 combine apache requests?

    - by Bruce
    To give you the situation in abstract: I have an ajax client that often needs to retrieve 3-10 static documents from the server. Those 3-10 documents are selected by the client out of about 100 documents in total. I have no way of knowing in advance which 3-10 documents the client will require. Additionally, those 100 documents are generated from database content, and so change over time. It seems messy to me to have to make 10 ajax requests for 10 separate documents. My first thought was to write a jsp that could use the include action. ie in pseudo code for (param in params){ jsp:include page="[param]" } But it turns out the tomcat doesn't just include the html resource, it recompiles it, generating a class file every time, which also seems wasteful. Does any one know of a neat solution for combining apache requests to static files to make one request, rather than several, but without the overhead of, for example, tomcat generating extra class files for each static file and regenerating them each time the static file changes? Thanks! Hopefully my question is clear - it's a bit long-winded.

    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

  • jquery mouse events masked by img in IE8 - all other platforms/browsers work fine

    - by Bruce
    Using the jQuery mouse events for mouseenter, mouseleave or hover all work swimmingly on all Mac or Windows browsers except for IE8/Windows. I am using mouseenter and mouseleave to test for hot rectangles (absolutely positioned and dimensioned divs that have no content) over an image used as hotspots to make visible the navigation buttons when different regions of the main enclosing rectangle (image) are touched by the cursor. Windows/IE jQuery never sends notifications (mouseenter our mouseleave) as the cursor enters or exits one of the target divs. If I turn off the visibility of the image everything works as expected (like it does in every other browser), so the image is effectively blocking all messages (the intention was for the image to be a background and all the divs float above it, where they can be clicked on). I understand that there's a z-index gotcha (so explicitly specifying z-index for each absolute positioned div does not work), but unclear as to how to nest or order multiple divs to allow a single set of jQuery rules to support all browsers. The image tag seems to trump all other divs and always appear in front of them... BTW: I could not use i m g as a tag in this text so it is spelled image in the following, so the input editor does not think that I am trying to pull a fast one on stackoverflow... How used? "mainview" is the background image, "zoneleft" and "zoneright" are the active areas where when the cursor enters the nav buttons "leftarrow" and rightarrow" are supposed to appear. Javascript $("div#zoneleft").bind("mouseenter",function () // enters left zone see left arrow { arrowVisibility("left"); document.getElementById("leftarrow").style.display="block"; }).bind("mouseleave",function () { document.getElementById("leftarrow").style.visibility="hidden"; document.getElementById("rightarrow").style.visibility="hidden"; }); HTML <div id="zoneleft" style="position:absolute; top:44px; left:0px; width:355px; height:372px; z-index:40;"> <div id="leftarrow" style="position:absolute; top:158px; left:0px; z-index:50;"><img src="images/newleft.png" width="59" height="56"/></div></div> <div id="zoneright" style="position:absolute; top:44px; left:355px; width:355px; height:372px; z-index:40;"> <div id="rightarrow" style="position:absolute; top:158px; left:296px; z-index:50;"> (tag named changed so that I could include it here) <image src="images/newright.png" width="59" height="56" /></div></div> </div><!-- navbuttons --> <image id="mainview" style="z-index:-1;" src="images/projectPhotos/photo1.jpg" width:710px; height:372px; /> (tag named changed so that I could include it here) </div><!--photo-->

    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

  • 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

  • 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

  • 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

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >