Search Results

Search found 3489 results on 140 pages for 'chris welsh'.

Page 100/140 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • Java: How to test methods that call System.exit()?

    - by Chris Conway
    I've got a few methods that should call System.exit() on certain inputs. Unfortunately, testing these cases causes JUnit to terminate! Putting the method calls in a new Thread doesn't seem to help, since System.exit() terminates the JVM, not just the current thread. Are there any common patterns for dealing with this? For example, can I subsitute a stub for System.exit()? [EDIT] The class in question is actually a command-line tool which I'm attempting to test inside JUnit. Maybe JUnit is simply not the right tool for the job? Suggestions for complementary regression testing tools are welcome (preferably something that integrates well with JUnit and EclEmma).

    Read the article

  • How do you use FastInfoset with JAXWS?

    - by Chris Kessel
    I've got code that looks like it should be correct based on what I can find, but the spewed output doesn't indicate that it's using FastInfoset. My understanding is the Accept should indicate it can accept Fastinfoset and the response would actually use it, meaning it's not text/xml as the response type. Any idea what I'm doing wrong? I've scoured with Google and I'm having a hard time finding much detail on how to use FastInfoset at all. JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass( C360Server.class); factory.setAddress("http://localhost:8501/cxfcontroller/cl_v5"); C360Server client = (C360Server)factory.create(); ((BindingProvider)client).getRequestContext().put( "com.sun.xml.ws.client.ContentNegotiation", "optimistic"); C360Request requestTrans = new C360Request(); ... code to fill in the request ... C360Response response = client.findContacts( requestTrans ); The logging doesn't seem to indicate FastInfoset is even attempted though: INFO: Outbound Message --------------------------- ID: 1 Address: http://localhost:8501/cxfcontroller/cl_v5 Encoding: UTF-8 Content-Type: text/xml Headers: {SOAPAction=[""], Authorization=[Basic cWFfc3VwZXI6cWFfc3VwZXI=], Accept=[*/*]} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:findContacts>...bunch of xml deleted for brevity...</ns1:findContacts></soap:Body></soap:Envelope> -------------------------------------- May 17, 2010 3:23:45 PM org.apache.cxf.interceptor.LoggingInInterceptor logging INFO: Inbound Message ---------------------------- ID: 1 Response-Code: 200 Encoding: UTF-8 Content-Type: text/xml; charset=utf-8 Headers: {content-type=[text/xml; charset=utf-8], Content-Length=[611], Server=[Jetty(6.1.x)]} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:findContactsResponse>...bunch of xml spew deleted for brevity...</ns1:findContactsResponse></soap:Body></soap:Envelope> -------------------------------------- Any ideas what I'm doing wrong? Even if the server wasn't supporting FastInfoset, I still should see the attempted negotiation in the request, right?

    Read the article

  • Why is FBJS dropping my 'onclick' attribute from this input element?

    - by Chris Barnhill
    When I include an 'onClick' attribute in setInnerXTHML() like this: var innerHtml = '<span>Build Track: Select a city where track building should begin'+ '<div id="action-end">'+ '<form>'+ '<input type="button" value="End Track Building" id="next-phase" onClick="moveTrainAuto();" />'+ '</form>'+ '</div></span>'; actionPrompt.setInnerXHTML(innerHtml); var btn = document.getElementById('next-phase'); btn.addEventListener('click', 'moveTrainAuto'); The 'onClick' gets dropped. I know this from inspecting the element with Firebug. This is what it reveals: <input id="app148184604666_next-phase" type="button" value="End Track Building"/> Here is the function called for onClick: function moveTrainAuto(evt) { debugger; ajax = new Ajax(); ajax.responseType = Ajax.JSON; ajax.ondone = function(data) { debugger; if(data.code == 'UNLOAD_CARGO') { unloadCargo(); } else if (data.code == 'MOVE_TRAIN_AUTO') { moveTrainAuto(); } else if (data.code == 'TURN_END') { turnEnd(); } else { /* handle error */ } } ajax.post(baseURL + '/turn/move-trains-auto'); } As you can see, I've tried both 'onClick' and 'addEventListener'. Neither works. Any ideas?

    Read the article

  • How can I execute an ANTLR parser action for each item in a rule that can match more than one item?

    - by Chris Farmer
    I am trying to write an ANTLR parser rule that matches a list of things, and I want to write a parser action that can deal with each item in the list independently. Some example input for these rules is: $(A1 A2 A3) I'd like this to result in an evaluator that contains a list of three MyIdentEvaluator objects -- one for each of A1, A2, and A3. Here's a snippet of my grammar: my_list returns [IEvaluator e] : { $e = new MyListEvaluator(); } '$' LPAREN op=my_ident+ { /* want to do something here for each 'my_ident'. */ /* the following seems to see only the 'A3' my_ident */ $e.Add($op.e); } RPAREN ; my_ident returns [IEvaluator e] : IDENT { $e = new MyIdentEvaluator($IDENT.text); } ; I think my_ident is defined correctly, because I can see the three MyIdentEvaluators getting created as expected for my input string, but only the last my_ident ever gets added to the list (A3 in my example input). How can I best treat each of these elements independently, either through a grammar change or a parser action change? It also occurred to me that my vocabulary for these concepts is not what it should be, so if it looks like I'm misusing a term, I probably am. EDIT in response to Wayne's comment: I tried to use op+=my_ident+. In that case, the $op in my action becomes an IList (in C#) that contains Antlr.Runtime.Tree.CommonTree instances. It does give me one entry per matched token in $op, so I see my three matches, but I don't have the MyIdentEvaluator instances that I really want. I was hoping I could then find a rule attribute in the ANTLR docs that might help with this, but nothing seemed to help me get rid of this IList. Result... Based on chollida's answer, I ended up with this which works well: my_list returns [IEvaluator e] : { $e = new MyListEvaluator(); } '$' LPAREN (op=my_ident { $e.Add($op.e); } )+ RPAREN ; The Add method gets called for each match of my_ident.

    Read the article

  • Javascript src starts with //?

    - by Chris
    I'm starting to see more and more script references show up like so: <script type="text/javascript" src="//somedomain.com/somescript.js"></script> Note the lack of http: at the beginning of the src attribute. It seems to work fine and avoids the messy requirement of detecting http vs https, but I've never actually seen this uri format referenced anywhere. Where did it come from? Is this behavior documented anywhere? Is it guaranteed to work in any browser?

    Read the article

  • How to remove htmlentities() values from the database?

    - by Chris
    Long before I knew anything - not that I know much even now - I desgined a web app in php which inserted data in my mysql database after running the values through htmlentities(). I eventually came to my senses and removed this step and stuck it in the output rather than input and went on my merry way. However I've since had to revisit some of this old data and unfortunately I have an issue, when it's displayed on the screen I'm getting values displayed which are effectively htmlentitied twice. So, is there a mysql or phpmyadmin way of changing all the older, affected rows back into their relevant characters or will I have to write a script to read each row, decode and update all 17 million rows in 12 tables?

    Read the article

  • jQuery drawing and modifying lines and positions

    - by Chris
    I want to allow people to select a feature region on an image using jQuery. This should work similarly to the Facebook tagger except once someone "tags" an area of the image an ellipse should appear with the ability for the user to rotate and scale it. How can I achieve this using jQuery?

    Read the article

  • Cast Object to JTable?

    - by Chris
    I am trying to implement a ListSelectionListener for some of my JTables. Simply (at the moment) the ListSelectionListener is supposed to simply return the text of the cell that was selected. My program design has several JTables and I would like to have one ListSelectionListener work for them all. In the valueChanged event of the ListSelectionListener I thought it was possible to do something like: private class SelectionHandler implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { JTable table = (JTable)e.getSource(); String data = (String) table.getValueAt(table.getSelectedRow(), 0); // Print data } } But when I do this I a ClassCastException error. Is there a way to do something like this? One solution I thought of was to compare the source of the event (e.getSource()) to all my JTables to see if they were equivalent (big if block) and then just calling .getValueAt inside that block but that would making the code in the future difficult if tables were to be added or removed.

    Read the article

  • VS2010 almost always zooms text on scroll

    - by Chris Barr
    You know the neat text zoom feature in VS2010 where you hold down Ctrl and then use your scroll wheel? Well, this seems to happen by default (and without ever pressing Ctrl) to nearly every file I open. Usually I open a file and have to scroll to some lower point, but instead it starts zooming the text! I have found that by tapping the Ctrl key VS then realizes that it should scroll instead of zoom, but it's still very annoying. Any ideas?

    Read the article

  • Detecting the onload event of a window opened with window.open

    - by Chris T
    window.popup = window.open($(this).attr('href'), 'Ad', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); $(window.popup).onload = function() { alert("Popup has loaded a page"); }; This doesn't work in any browser I've tried it with (IE, Firefox, Chrome). How can I detect when a page is loaded in the window (like an iframe onload)?

    Read the article

  • On iPhone, what does EPERM (errno == 1) mean in reponse to send() of UDP data?

    - by Chris Markle
    We sending data over UDP from the iPhone, sometimes, but not always, in response to our first send() of UDP data, we are getting back a -1 return code and errno set to 1 (EPERM / operation not permitted). The EPERM result for send(), sendto() and sendmsg() is not documented in the man pages as a return result from those functions. Has anyone out there encountered this and might be able to shed some light on what this errno value means in this context?

    Read the article

  • Can't touch UITextField on UIScrollView

    - by Chris B
    Hey guys, I know this has been talked about a lot. I think I've gone thru every question on this site, and still have not been able to get this working. I'm new to developing but I have a good sense of what's going on with all of my code. I definitely don't have a lot of experience though, this is my first iPhone app. I'm making a data entry field that is comprised of multiple UITextFields within a UIScrollView. I'll avoid explaining the other details for now, as it seems its a very basic problem. Without a scrollview, the textfields work perfectly. I can touch the textfield and the keyboard or picker view show up appropriately. When I add the textfields to a scrollview, the scrollview works, but then the text fields don't receive my touches. Here's the key: When 'User Interaction' is ENABLED, the scrollview works but the textfield touches are NOT registered. When 'User Interaction' is DISABLED, the scrollview doesn't work, but the textfield touches ARE registered and the keyboard/picker pops up. From the other posts I have seen people creating subclasses and overriding the touches in a separate implementation. I've seen people using custom content views (subviews?), I've seen some solutions that are now obsolete since the APIs have changed in newer versions of the SDK, and I am just completely stuck. I will leave out my code for now, because maybe there is a solution that someone has without requiring my code. If someone needs to see my code, I will put it up. My app is being written in the 3.1.3 SDK. If anyone has ANY information that could help, it would be so greatly appreciated.

    Read the article

  • Is there an x86 or x64 emulator that passes system calls back to the Windows API?

    - by Chris Lomont
    I want to emulate windows programs (not VM, true emulation) under windows. This would require the emulator to make calls back to the system APIs, but the program itself would be emulated. The reason is I want to change the opcode formats for research purposes. The process should be: Take existing program. Disassemble and then reassemble with my new opcode formats. Put the new format into the PE with a stub calling the emulator and passing the new code. The emulator would have to pass system calls from the emulated side back to windows API calls. I can do all these steps, except I need an open source emulator with the ability to pass the API calls out. I could try Bochs or QEMU, but I think I'd have to add in the system calls, which I could do if needed. I wonder if there is already something closer to what I need. I know I would have to change the instruction decoding in the emulator to match my new formats, but that is a given. Thanks.

    Read the article

  • Need some help synch'ing outer loop counter with dialog.onconfirm()

    - by Chris Barnhill
    I am writing a game for Facebook. IN the following code, I have a problem. I have a for loop executing, and in that loop, I call a dialog and implement 'onconfirm' for the dialog. The problem is that I need to access th e loop counter inside of the onconfirm function. But because the onconfirm is called outside of the scope of the for loop, the counter value is no longer valid because it's been incremented. I need some way to pass the counter value to the dialog onconfirm as it was at the time the dialog was displayed, not after the loop has finished. Or maybe someone has a better solution. Any help would be appreciated. Thanks. function unloadCargo() { //debugger; var actionPrompt = document.getElementById('action-prompt'); actionPrompt.setTextValue('Unloading cargo...'); var ajax = new Ajax(); ajax.responseType = Ajax.JSON; ajax.ondone = function(data) { debugger; if(data.unloadableCargo.length == 0) { loadCargo(); } else { //console.log('unloadable cargo='+dump(data.unloadableCargo)); var i = 0; var j = 0; var ucCount = data.unloadableCargo.length; for(i = 0; i < ucCount; i++) { cargoDialog = new Dialog(); cargoDialog.showChoice('Unload Cargo', 'Unload ' + data.unloadableCargo[i].goods_name + ' at ' + data.unloadableCargo[i].city_name + ' for ' + data.unloadableCargo[i].payoff + 'M euros?'); cargoDialog.onconfirm = function() { //console.log('unloadable cargo onconfirm='+dump(data.unloadableCargo)); var ajax = new Ajax(); var param = {"city_id": data.unloadableCargo[i].city_id, "goods_id": data.unloadableCargo[i].goods_id, "payoff": data.unloadableCargo[i].payoff}; ajax.ondone = function(demandData) { var demands = document.getElementById('demands'); var innerXhtml = '<span>'; for(var j = 0; j < demandData.demands.length; j++) { innerXhtml = innerXhtml + ' <div class="demand-item"><div class="demand-city">' + demandData.demands[j].city + '</div><div class="demand-pay">' + demandData.demands[j].cost + '</div><div class="demand-goods">' + demandData.demands[j].goods + '</div></div>'; } innerXtml = innerXhtml + ' </span>'; demands.setInnerXHTML(innerXhtml); // update balance loadCargo(); } ajax.post(baseURL + "/turn/do-unload-cargo", param); } cargoDialog.oncancel = function() { loadCargo(); } } //loadCargo(); } } ajax.post(baseURL + '/turn/unload-cargo'); }

    Read the article

  • Formatting numbers with significant figures in C#

    - by Chris Farmer
    I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occasionally it will be 4 or 5. Is there any convenient way to handle this?

    Read the article

  • converting rgb values to System.Drawing

    - by Chris
    Hi, I've looked around, but don't see this question - maybe its too easy, but I don't have it. If I have file containing color values like: 255, 65535, 65280 ( I think this is green) is there a way to either: convert these to a System.Drawing.Color type or....better yet.. have .NET accept them as is to represent the color? thanks,

    Read the article

  • How are two-dimensional arrays formatted in memory?

    - by Chris Cooper
    In C, I know I can dynamically allocate a two-dimensional array on the heap using the following code: int** someNumbers = malloc(arrayRows*sizeof(int*)); for (i = 0; i < arrayRows; i++) { someNumbers[i] = malloc(arrayColumns*sizeof(int)); } Clearly, this actually creates a one-dimensional array of pointers to a bunch of separate one-dimensional arrays of integers, and "The System" can figure you what I mean when I ask for: someNumbers[4][2]; But when I statically declare a 2D array, as in the following line...: int someNumbers[ARRAY_ROWS][ARRAY_COLUMNS]; ...does a similar structure get created on the stack, or is it of another form completely? (i.e. is it a 1D array of pointers? If not, what is it, and how do references to it get figured out?) Also, when I said, "The System," what is actually responsible for figuring that out? The kernel? Or does the C compiler sort it out while compiling?

    Read the article

  • Excel 2007 - Worksheet is larger than the window

    - by Chris
    Hi This is an odd problem but frustrating none the less. I have a worksheet saved which is larger than the Excel 2007 "workarea". This means when I open the worksheet I cannot access the corners of the worksheet to reduce the size and the worksheets title bar area (with move,size,minimise etc) is hidden beneath the ribbon , even if I remove the ribbon , I still can't see the title bar. In Excel 2003 I've had a similar effect but I've always been able to hit the "alt" key to access the "Move" option. However in Excel 2007 , hitting "alt" brings up some shortcuts for the ribbon etc but I can't access the worksheet options. Has anyone else know how to access the worksheet drop down when this happens?

    Read the article

  • Configuring Warden for use in RSpec controller specs

    - by Chris Peters
    I was able to use Devise's sign_in method to log in a user in my controller specs. But now that I'm removing Devise from my application, I'm not quite sure how to get similar functionality working with just Warden on its own. How should I go about setting up spec/spec_helper.rb and related spec/support/*.rb files to get Warden running within controller specs sufficiently? I've tried setting up a file at spec/support/warden.rb with these contents: RSpec.configure do |config| config.include Warden::Test::Helpers config.after do Warden.test_reset! end end Then I have before calls similar to this to authenticate a user factory: before { login_as FactoryGirl.create(:user) } But here is the error that I keep seeing: NameError: undefined method `user' for nil:NilClass This error traces back to my authenticate_user! method in the controller: def authenticate_user! redirect_to login_path, notice: "You need to sign in or sign up before continuing." if env['warden'].user.nil? end I'd appreciate any guidance that anyone could provide.

    Read the article

  • Codeigniter Image Library Cropping an Image with 2 sets of coordinates to make square anywhere?

    - by chris
    Spending time reading through the docs, and searching for examples. I understand cropping an image from top 0, and left 0 is pretty straight forward. However. I would like to pass 2 sets of coordinates, a starting point and an ending point. Four Points, a Square that is defined anywhere. However from the examples I am finding, and from what I gather the rendition is not going to let me do this. codeigniter so I am seeking confirmation on this thought, is it true that I can only provide end points from 0, and it crops a square based on said end points or can I actually specify an x start, an x end, and similar for y? Or is there some other technique I can use within codeigniter that will allow me to pass for coordinates for starting and ending points?

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >