Search Results

Search found 5259 results on 211 pages for 'interrupt handling'.

Page 61/211 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • Swing and handling threads

    - by James P.
    There's a couple questions here on StackOverflow on the subject of threading with the Swing api but things still aren't clear. What is the issue with the EDT, what is the proper way to initiate a Thread with Swing and in what cases should it be used? P.S: Any sources in terms of good practises would be appreciated.

    Read the article

  • Centralizing Messagebox handling for application

    - by DRapp
    I'm wondering how others deal with trying to centralize MessageBox function calling. Instead of having long text embedded all over the place in code, in the past (non .net language), I would put system and application base "messagebox" type of messages into a database file which would be "burned" into the executable, much like a resource file in .Net. When a prompting condition would arise, I would just do call something like MBAnswer = MyApplication.CallMsgBox( IDUserCantDoThat ) then check the MBAnswer upon return, such as a yes/no/cancel or whatever. In the database table, I would have things like what the messagebox title would be, the buttons that would be shown, the actual message, a special flag that automatically tacked on a subsequent standard comment like "Please contact help desk if this happens.". The function would call the messagebox with all applicable settings and just return back the answer. The big benefits of this was, one location to have all the "context" of messages, and via constants, easier to read what message was going to be presented to the user. Does anyone have a similar system in .Net to do a similar approach, or is this just a bad idea in the .Net environment.

    Read the article

  • Java - Handling Non-Blocking Calls

    - by sarav
    In my application I am using a third-party API. It is a non-blocking method which returns immediately. I have a collection of elements over which I have to invoke this method. Now, my problem is that I have to find a way till all the method execution gets completed and do my next operation. How can I handle this? I cannot modify the third-party API. In short it looks like this for(Object object: objects){ methodA(object); //this is a non-blocking call and returns immediately } // here I want to do my next task only after all the methodA calls completed execution

    Read the article

  • handling javaScript alerts when running a selenium test?

    - by Mo
    Hi I am am running some selenium tests(ruby) on my web page and as i enter an invalid characters in to a text box i have the JavaScript throw a alert like so if(isNaN($(this).val()) || Number($(this).val().valueOf() <=0)){ alert("Please Enter A Number"); } how can i handle this alert when its made and close the pop up? i tried to use the wait_for_pop_up() and close() but i think that's only for browser pop up's and not JavaScript alerts. any ideas? thanks

    Read the article

  • Proper exceptions to use for nulls

    - by user200295
    In the following example we have two different exceptions we want to communicate. //constructor public Main(string arg){ if(arg==null) throw new ArgumentNullException("arg"); Thing foo=GetFoo(arg); if(foo==null) throw new NullReferenceException("foo is null"); } Is this the proper approach for both exception types?

    Read the article

  • Handling row selection from a simple grid using jquery and asp.net mvc

    - by Jonn
    Using a simple table and jquery, how would you manually handle selection using jquery? So far, I've managed to add a gridrowselected class on the tr when the click event is called so that I'll know which row is currently selected. But I don't know how to pass the selected data back to the controller (or at least an index I placed on the row). I tried something like this $(function() { $('#ProjectList .gridrow').click(function() { // Get row's index var projectId = $(this).find('input[name$=ProjectId]').val(); // Remove the input if it already exists var parentForm = $(this).parents('form'); parentForm.remove('input[name="selectedRows"][value="' + projectId + '"]'); // If it is selected, create the form. If it's not selected then the input just gets removed (the user must have clicked on it and deselected the row) if ($(this).hasClass('gridrow-selected') === true) { parentForm.append($('<input>', { type: "hidden", name: "selectedRows", value: projectId })); } }); }); which I'm expecting to create a hidden input so that when I post, selectedRows gets passed onto the controller. But all it does is create the input, but the data still doesn't get passed to the controller.

    Read the article

  • Event is causing an error, but I can't catch the exception

    - by proudgeekdad
    A developer has created a custom control in ASP.NET using VB.NET. The custom control uses a repeater. In certain scenarios, the rpt_ItemDataBound event is encountering a data error. My goal is rather than having the user see the yellow screen of death, give the user a friendlier error explaining exactly what the data error is. I figured I would be able to use a Try/Catch block as shown below throw the exception, however, it appears that the event has nowhere to be thrown to and stops executing at the "End Try" line. Protected Sub rpt_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rpt1.ItemDataBound, rpt2.ItemDataBound Try ProcessBadData... Catch ex As Exception Throw ex End Try End Sub In VB.NET, I can find where the repeater's DataSource is being set, however, I can not find a DataBind event. Any ideas how I can capture the exception in this ASCX control so I can report it to the user?

    Read the article

  • WPF button click in C# code

    - by KMC
    I have an array of button which is dynamically generated at run time. I have the function for button click in my code, but I can't find a way to set the button's click name in code. So, what is the code equivalent for XAML: <Button x:Name="btn1" Click="btn1_Click"> Or, what should I place for "????" in the following Code: Button btn = new Button()btn.Name = "btn1";btn.???? = "btn1_Click";

    Read the article

  • How to prevent swallowing exceptions caused by unset expectations for a mocked object?

    - by Schultz9999
    I am looking for a way to modify catch block depending on if it's executed during the unit test run or not. The purpose is basically to detect/setup mock expectations which are swallowed because catch doesn't rethrow. I am using MSTest. One obvious thing is using preprocessor but I don't think it works. Especially if to use DEBUG define. There should be an easy way to detect that, shouldn't it? I must have been looking for something wrong because I couldn't find much info on that. try {...} catch(Exception) { Log(...); #if DEBUG throw; #endif }

    Read the article

  • Handling multiple media queries in Sass with Twitter Bootstrap

    - by Keith
    I have a Sass mixin for my media queries based on Twitter Bootstrap's responsive media queries: @mixin respond-to($media) { @if $media == handhelds { /* Landscape phones and down */ @media (max-width: 480px) { @content; } } @else if $media == small { /* Landscape phone to portrait tablet */ @media (max-width: 767px) {@content; } } @else if $media == medium { /* Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { @content; } } @else if $media == large { /* Large desktop */ @media (min-width: 1200px) { @content; } } @else { @media only screen and (max-width: #{$media}px) { @content; } } } And I call them throughout my SCSS file like so: .link { color:blue; @include respond-to(medium) { color: red; } } However, sometimes I want to style multiple queries with the same styles. Right now I'm doing them like this: .link { color:blue; /* this is fine for handheld and small sizes*/ /*now I want to change the styles that are cascading to medium and large*/ @include respond-to(medium) { color: red; } @include respond-to(large) { color: red; } } but I'm repeating code so I'm wondering if there is a more concise way to write it so I can target multiple queries. Something like this so I don't need to repeat my code (I know this doesn't work): @include respond-to(medium, large) { color: red; } Any suggestions on the best way to handle this?

    Read the article

  • Handling a Long Running jsp request on the server using Ajax and threads

    - by John Blue
    I am trying to implement a solution for a long running process on the server where it is taking about 10 min to process a pdf generation request. The browser bored/timesout at the 5 mins. I was thinking to deal with this using a Ajax and threads. I am using regular javascript for ajax. But I am stuck with it. I have reached till the point where it sends the request to the servlet and the servlet starts the thread.Please see the below code public class HelloServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("POST request!!"); LongProcess longProcess = new LongProcess(); longProcess.setDaemon(true); longProcess.start(); request.getSession().setAttribute("longProcess", longProcess); request.getRequestDispatcher("index.jsp").forward(request, response); } } class LongProcess extends Thread { public void run() { System.out.println("Thread Started!!"); while (progress < 10) { try { sleep(2000); } catch (InterruptedException ignore) {} progress++; } } } Here is my AJax call <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>My Title</title> <script language="JavaScript" > function getXMLObject() //XML OBJECT { var xmlHttp = false; xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers return xmlHttp; // Mandatory Statement returning the ajax object created } var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object function ajaxFunction() { xmlhttp.open("GET","HelloServlet" ,true); xmlhttp.onreadystatechange = handleServerResponse; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(null); } function handleServerResponse() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.forms[0].myDiv.value = xmlhttp.responseText; setTimeout(ajaxFunction(), 2000); } else { alert("Error during AJAX call. Please try again"); } } } function openPDF() { document.forms[0].method = "POST"; document.forms[0].action = "HelloServlet"; document.forms[0].submit(); } function stopAjax(){ clearInterval(intervalID); } </script> </head> <body><form name="myForm"> <table><tr><td> <INPUT TYPE="BUTTON" NAME="Download" VALUE="Download Queue ( PDF )" onclick="openPDF();"> </td></tr> <tr><td> Current status: <div id="myDiv"></div>% </td></tr></table> </form></body></html> But I dont know how to proceed further like how will the thread communicate the browser that the process has complete and how should the ajax call me made and check the status of the request. Please let me know if I am missing some pieces. Any suggestion if helpful.

    Read the article

  • Implication of (not) rethrowing exception after logging

    - by dotnetdev
    Hi, In a team environment, if I handle an exception (like so): protected void Page_Load(object sender, EventArgs e) { this.exTest(); } public void exTest() { try { throw new Exception("sjsj"); } catch (Exception ex) { string s = ex.Message; throw; } } What is the implication of not rethrowing the exception (throw)? Even without the keyword the custom error settings in web.config are used (redirection to specified page). Thanks

    Read the article

  • Window resolution handling without javascript

    - by Sai Sasdhar
    Is there any CSS property to deal window resolution. I created a HTML page taking total resolution width as 1424px.When I open it on different resolution I see a scroll bar & resolution of HTML does not adjust automatically. I don't want the scrollbar to be seen in maximized size of the page. Is it possible without using javascript.At the same time how to increase the resolution when itself is created in lower res.

    Read the article

  • Handling multiple accounts in Android app

    - by bebeTech
    I would like to build an application that caters for multiple accounts (eg. home, work) and account types (e.g. ISP, VoIP, Mobile). Essentially, I would like to get the user to create the accounts they want and then have all the accounts listed on the start page grouped by type. For example: ISP: - Home - Work Mobile: - Mum - Dad When you click on the account, it would take you to another screen where I do a bunch of calcs and display the results. I currently do this via multiple apps but am looking at consolidating into the one app. I am just not sure where to start or how I go about achieving this? The way the Contacts app works is a good example of what I am wanting to do.

    Read the article

  • How to know the file type of the file which you are forcing the user to download?

    - by Starx
    I am trying to force the user to download a file. For that my script is: $file = "file\this.zip"; header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: application/zip"); //This is what I need header("Content-Transfer-Encoding: binary"); readfile($file); The files I am going to upload my not be .zip all the time so I want to know the content type of the image I am going to receive in $file. How to accomplish this

    Read the article

  • Browser not handling exception from AJAX panel, ASP.NET c#

    - by Grant
    Hi, i am having trouble catching errors in an AJAX panel. Even when i throw an exception in the c# code behind the front end completely ignores it. Here is the code i have setup, can anyone see why? I ideally want to show a js alert window on error. Code Behind: protected void btnX_Click(object sender, EventArgs e) { throw new ApplicationException("test"); } protected void ScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e) { ScriptManager.AsyncPostBackErrorMessage = e.Exception.Message; } Markup: <script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, e) { window.alert(e.get_error().name); } </script> <asp:ScriptManager ID="ScriptManager" runat="server" AllowCustomErrorsRedirect="true" OnAsyncPostBackError="ScriptManager_AsyncPostBackError" />

    Read the article

  • Why vba doesnt handling Error 2042

    - by Jonathan Raul Tapia Lopez
    I have a variable "fila" with a full line with excel's values; The problem is when in excel I have --#N/A-- vba take that value like "Error 2042" and I cannot asign that value to "valor" and produce me an error, until this point everything is ok, now I am trying to define a "On error goto" for go to the "next" iteration in the loop "for", but I dont know Why vba doesnt handle the error. Do While Not IsEmpty(ActiveCell) txt = ActiveCell.Value2 cell = ActiveCell.Offset(0, 1).Value2 fila = Range("C20:F20") For j = 1 To UBound(fila, 2) On Error GoTo Siguiente If Not IsEmpty(fila(1, j)) Then valor = fila(1, j) cmd = Cells(1, j + 2).Value2 devolver = function1(cmd, txt, cell, valor) arrayDevolver(p) = devolver p = p + 1 End If Siguiente: Next Loop '

    Read the article

  • Problem with handling click event of bitmap

    - by shaina
    i am using navigationClick method to handle click event of Bitmap images & Buttons it works fine when i dont use VerticalFieldManger . But when i adjust positions of field using this field manager then it doesnt capture click event of all controls just on capture Index(0) click which i think is verticalFieldmanager not other (Bitmaps & Buttons fields) Plzzzzzz help how to resolve it code is protected boolean navigationClick(int status, int time) { Field field = this.getFieldWithFocus(); if(field.getIndex()==0) { Dialog.alert("Index 0 (bitmaP) clicked"); } if(field.getIndex()==1) { Dialog.alert("Index 1(Button 1) clicked"); } if(field.getIndex()==2) { Dialog.alert("Index 2 (Button2) Clicked"); } if(field.getIndex()==3) { Dialog.alert("Index 3(bitmap2) Clicked"); } }

    Read the article

  • How to implement event notification mechanism in AIR

    - by nxhoaf
    Do you know how to implement event notification mechanism in AIR ? For simplicity, consider an example: I want to build two applications: "television" and "remote". Among them, television is implemented using AIR. For the "television" I want to use my remote to send message to the television. How must I do to implement "television" in such way that, it runs in waiting mode and whenever it receives a message from "remote", it will process the message and make a suitable action (i.e. change channel, increase volume...). Thank you in advance.

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >