Search Results

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

Page 30/211 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • jQuery: Dynamic image handling (waiting for load)

    - by dclowd9901
    I'm trying to write a plugin that has a built in function to wait until all images that are on the page to be loaded before it executes itself. $(window).load() only works if it's the initial load of the page, but if someone wants to pull down some HTML through AJAX that contains images, it doesn't work. Is there any good way of doing this AND implementing it so that it can be self-contained in the plug-in? I've tried looping over $('img').complete, and I know that doesn't work (the images never load, and the browser crashes under a "script takes too long to complete" bug). For an example of what I'm trying to do, visit the page I'm looking to house the plugin at: http://www.simplesli.de If you go to the "more uses" section (click it on the nav bar), you'll see that the image slideshow won't load properly. I know the current code doesn't work, but it's just holding place until I figure something out.

    Read the article

  • Webforms MVP Passive View - event handling

    - by ss2k
    Should the view have nothing event specific in its interface and call the presenter plain methods to handle events and not have any official EventHandlers? For instance // ASPX protected void OnSaveButtonClicked(object sender, EventArgs e) { _Presenter.OnSave(); } Or should the view have event EventHandlers defined in its interface and link those up explicitly to control events on the page // View public interface IView { ... event EventHandler Saved; ... } // ASPX Page implementing the view protected override void OnInit(EventArgs e) { base.OnInit(e); SaveButton.Click += delegate { Saved(this, e); }; } // Presenter internal Presenter(IView view,IRepository repository) { _view = view; _repository = repository; view.Saved += Save; } The second seems like a whole lot of plumbing code to add all over. My intention is to understand the benefits of each style and not just a blanket answer of which to use. My main goals is clarity and high value testability. Testability overall is important, but I wouldn't sacrifice design simplicity and clarity to be able to add another type of test that doesn't lead to too much gain over the test cases already possible with a simpler design. If a design choice does off more testability please include an example (pseudo code is fine) of the type of test it can now offer so I can make my decision if I value that type of extra test enough. Thanks!

    Read the article

  • How can I programmatically link an UIView or UIImageView with an event like "touch up inside"?

    - by Thanks
    Interface Builder will only allow me to hook up such events for an button. But like in HTML, I just want to haven an blank UIImageView where - as soon as the user taps it - a method is invoked. I hope there is some cool programmatically way of doing that, which I don't know about. UPDATE: In my View Controller that creates the UIImageView I tried to do this: SEL actionSelector = @selector(doSomethingWhenImageIsTouched:); [self.myUIImageView addTarget:nil action:actionSelector forControlEvents:UIControlEventTouchUpInside]; The compiler gives me a warning, that UIImageView may not respond to addTarget:... what do I have to do so that it works with an UIImageView. I see in the docs that UIImageView does not inherit from UIControl, but addTarget: is part of UIControl. UPDATE: I ended up creating an UIButton after creating the UIImageView. Then I set the frame of that button to the frame of the UIImageView, and alpha to 0.1f. For some reason, it will not work if alpha is 0.0f. And then, I did that cool addTarget: thing...

    Read the article

  • How to catch all exceptions in Flex?

    - by Yaba
    When I run a Flex application in the debug flash player I get an exception pop up as soon as something unexpected happened. However when a customer uses the application he does not use the debug flash player. In this case he does not get an exception pop up, but he UI is not working. So for supportability reasons, I would like to catch any exception that can happen anywhere in the Flex UI and present an error message in a Flex internal popup. By using Java I would just encapsulate the whole UI code in a try/catch block, but with MXML applications in Flex I do not know, where I could perform such a general try/catch.

    Read the article

  • Capturing unhandled exceptions in .Net 2.0. Wrong event called.

    - by SoMoS
    Hello, I'm investigating a bit about how the unhandled exceptions are managed in .Net and I'm getting unexpected results that I would like to share with you to see what do you think about. The first one is pretty simple to see. I wrote this code to do the test, just a button that throws an Exception on the same thread that created the Form: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Throw New Exception() End Sub Private Sub UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs) MsgBox(String.Format("Exception: {0}. Ending: {1}. AppDomain: {2}", CType(e.ExceptionObject, Exception).Message, e.IsTerminating.ToString(), AppDomain.CurrentDomain.FriendlyName)) End Sub Private Sub UnhandledThreadException(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs) MsgBox(String.Format("Exception: {0}. AppDomain: {1}", e.Exception.Message(), AppDomain.CurrentDomain.FriendlyName)) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf UnhandledException AddHandler Application.ThreadException, AddressOf UnhandledThreadException End Sub End Class When I execute the code inside the Visual Studio the UnhandledException is called as expected but when I execute the application from Windows the UndhanledThreadException is called instead. ¿?¿?¿¿?¿? Someone has any idea of what can be happening here? Thanks in advance.

    Read the article

  • how to rethrow same exception in sql server

    - by Shantanu Gupta
    I want to rethrow same exception in sql server that has been occured in my try block. I am able to throw same message but i want to throw same error. BEGIN TRANSACTION BEGIN TRY INSERT INTO Tags.tblDomain (DomainName, SubDomainId, DomainCode, Description) VALUES(@DomainName, @SubDomainId, @DomainCode, @Description) COMMIT TRANSACTION END TRY BEGIN CATCH declare @severity int; declare @state int; select @severity=error_severity(), @state=error_state(); RAISERROR(@@Error,@ErrorSeverity,@state); ROLLBACK TRANSACTION END CATCH RAISERROR(@@Error, @ErrorSeverity, @state); This line will show error, but i want functionality something like that. This raises error with error number 50000, but i want erron number to be thrown that i am passing @@error, I want to capture this error no at frontend i.e. catch (SqlException ex) { if ex.number==2627 MessageBox.show("Duplicate value cannot be inserted"); } I want this functionality. which can't be achieved using raiseerror. I dont want to give custom error message at back end.

    Read the article

  • When and where to call the RemoveHandler in VB.NET?

    - by marco.ragogna
    I am working to a VB.NET windows forms projet in .NET 1.1. And I have this type of architecture, very simplified. Public MustInherit Class BaseTestLogic Private _TimerPoll As Timer Public Sub New(ByVal sym As SymbolFileMng, ByVal cfg As LampTestConfig, ByVal daas As DaasManager, ByVal mcf As Elux.Wg.Lpd.MCFs.VMCF) AddHandler _TimerPoll.Tick, AddressOf TimerPoll_Tick End Sub End Class Public Class SpecificTestLogic Inherits BaseTestLogic End Class Depending of the type of test I am doing I create an instance of a specific test derived from BaseTestLogic. But I found that after hundreds of object creations I can have StackOverflow exception. I checked my code and saw that I forgot to remove the handler to Timer Tick. The question is, where and when is it correct to remove hadler? Do I need to implement the IDisposable interface in the base class and RemoveHandler in Dispose?

    Read the article

  • JQuery Ajax error handling, show custom exception messages

    Hey Folks, I am wondering if there is some way where I can show custom exception messages as an alert in my Jquery ajax error message. For example, say if I want to throw an exception in server side via Struts by "throw new ApplicationException("User name already exists");", I want to catch this message(User name already exists) in Jquery ajax error message. jQuery("#save").click(function(){ if(jQuery('#form').jVal()){ jQuery.ajax({ type: "POST", url: "saveuser.do", dataType:"html", data:"userId="+encodeURIComponent(trim(document.forms[0].userId.value)), success:function(response){ jQuery("#usergrid").trigger("reloadGrid"); clear(); alert("Details saved successfully!!!"); }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); } } ); On the second alert where I alert thrown error, I am getting undefined and the status code is 500. I am not sure where I am going wrong. Please let me know on this. Thanks, Dukes

    Read the article

  • Adding click/double-click events to static group box controls

    - by omatai
    Having realised my own reasons were way too dubious, I've now gone about this a different way. But I'm still curious... For reasons of nostalgia, familiarity and laziness, I'm coding a UI with MFC. For dubious reasons (as if those were not enough), I wanted to add a (double-)click event to a group box. Naturally, the group box contains things - in fact, it contains another static item, to which I can successfully add a (double-)click event handler. Is there any reason I cannot get an event handler to work for clicks on my group box the same way I can do that for the simple text static item? No amount of clicking on, in or near the control fires the event. Note - I've read through http://www.codeproject.com/KB/static/staticctrl_tut.aspx and tried responding to both ON_STN_... events and ON_BN_... messages, setting the notify style (BS_NOTIFY appears in the rc file)... and still I'm missing something - what is it? Is it even possible? Most of what I've googled suggests it is... but without clear answers for C++/MFC. Since first posting this question, I've found reference to a WM_NCHITTEST message, and hints that you have to create a handler for this message to override the group box default behaviour of responding with HT_TRANSPARENT... despite having its transparent property in ClassWizard set to false. Hmmm. Can anyone confirm that this is indeed the key?

    Read the article

  • Event Handlers Not Getting Called? - wxWidgets

    - by Alex
    Hello all, I'm working on a program for my C++ programming class, using wxWidgets. I'm having a huge problem in that my event handlers (I assume) are not getting called, because when I click on the button to trigger the event, nothing happens. My question is: Can you help me find the problem and explain why they would not be getting called? The event handlers OnAbout and OnQuit are working, just not OnCompute or OnClear. I'm really frustrated as I can't figure this out. Thanks a bunch in advance! #include "wx/wx.h" #include "time.h" #include <string> using std::string; // create object of Time class Time first; class App: public wxApp { virtual bool OnInit(); }; class MainPanel : public wxPanel { public: // Constructor for panel class // Constructs my panel class // Params - wxWindow pointer // no return type // pre-conditions: none // post-conditions: none MainPanel(wxWindow* parent); // OnCompute is the event handler for the Compute button // params - none // preconditions - none // postconditions - tasks will have been carried otu successfully // returns void void OnCompute(wxCommandEvent& WXUNUSED(event)); // OnClear is the event handler for the Clear button // params - none // preconditions - none // postconditions - all text areas will be cleared of data // returns void void OnClear(wxCommandEvent& WXUNUSED(event)); // Destructor for panel class // params none // preconditions - none // postconditions - none // no return type ~MainPanel( ); private: wxStaticText *startLabel; wxStaticText *endLabel; wxStaticText *pCLabel; wxStaticText *newEndLabel; wxTextCtrl *start; wxTextCtrl *end; wxTextCtrl *pC; wxTextCtrl *newEnd; wxButton *compute; wxButton *clear; DECLARE_EVENT_TABLE() }; class MainFrame: public wxFrame { private: wxPanel *mainPanel; public: MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size); void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); ~MainFrame(); DECLARE_EVENT_TABLE() }; enum { ID_Quit = 1, ID_About, BUTTON_COMPUTE = 100, BUTTON_CLEAR = 200 }; IMPLEMENT_APP(App) BEGIN_EVENT_TABLE(MainFrame, wxFrame) EVT_MENU(ID_Quit, MainFrame::OnQuit) EVT_MENU(ID_About, MainFrame::OnAbout) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MainPanel, wxPanel) EVT_MENU(BUTTON_COMPUTE, MainPanel::OnCompute) EVT_MENU(BUTTON_CLEAR, MainPanel::OnClear) END_EVENT_TABLE() bool App::OnInit() { MainFrame *frame = new MainFrame( _("Good Guys Delivery Time Calculator"), wxPoint(50, 50), wxSize(450,340) ); frame->Show(true); SetTopWindow(frame); return true; } MainPanel::MainPanel(wxWindow* parent) : wxPanel(parent) { startLabel = new wxStaticText(this, -1, "Start Time:", wxPoint(75, 35)); start = new wxTextCtrl(this, -1, "", wxPoint(135, 35), wxSize(40, 21)); endLabel = new wxStaticText(this, -1, "End Time:", wxPoint(200, 35)); end = new wxTextCtrl(this, -1, "", wxPoint(260, 35), wxSize(40, 21)); pCLabel = new wxStaticText(this, -1, "Percent Change:", wxPoint(170, 85)); pC = new wxTextCtrl(this, -1, "", wxPoint(260, 85), wxSize(40, 21)); newEndLabel = new wxStaticText(this, -1, "New End Time:", wxPoint(180, 130)); newEnd = new wxTextCtrl(this, -1, "", wxPoint(260, 130), wxSize(40, 21)); compute = new wxButton(this, BUTTON_COMPUTE, "Compute", wxPoint(135, 185), wxSize(75, 35)); clear = new wxButton(this, BUTTON_CLEAR, "Clear", wxPoint(230, 185), wxSize(75, 35)); } MainPanel::~MainPanel() {} MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame( NULL, -1, title, pos, size ) { mainPanel = new MainPanel(this); wxMenu *menuFile = new wxMenu; menuFile->Append( ID_About, _("&About...") ); menuFile->AppendSeparator(); menuFile->Append( ID_Quit, _("E&xit") ); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append( menuFile, _("&File") ); SetMenuBar( menuBar ); CreateStatusBar(); SetStatusText( _("Hi") ); } MainFrame::~MainFrame() {} void MainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } void MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageBox( _("Alex Olson\nProject 11"), _("About"), wxOK | wxICON_INFORMATION, this); } void MainPanel::OnCompute(wxCommandEvent& WXUNUSED(event)) { int startT; int endT; int newEndT; double tD; wxString startTString = start->GetValue(); wxString endTString = end->GetValue(); startT = wxAtoi(startTString); endT = wxAtoi(endTString); pC->GetValue().ToDouble(&tD); first.SetStartTime(startT); first.SetEndTime(endT); first.SetTimeDiff(tD); try { first.ValidateData(); newEndT = first.ComputeEndTime(); *newEnd << newEndT; } catch (BaseException& e) { wxMessageBox(_(e.GetMessage()), _("Something Went Wrong!"), wxOK | wxICON_INFORMATION, this); } } void MainPanel::OnClear(wxCommandEvent& WXUNUSED(event)) { start->Clear(); end->Clear(); pC->Clear(); newEnd->Clear(); }

    Read the article

  • How to handle Android SimpleExpandableListAdapter entry selection.

    - by DaveG
    I have created an expandable list in my Android application using the SimpleExpandableListAdapter type. But I'm at a complete loss as to how I detect events when one of the child entries has been selected/clicked. I've tried all the usual OnClickListener/OnChildClickListener etc, but can't seem to find (by experimentation, or half an hour googling) what the correct handler routines should be. Any help greatfully appreciated.

    Read the article

  • A couple of questions on exceptions/flow control and the application of custom exceptions

    - by dotnetdev
    1) Custom exceptions can help make your intentions clear. How can this be? The intention is to handle or log the exception, regardless of whether the type is built-in or custom. The main reason I use custom exceptions is to not use one exception type to cover the same problem in different contexts (eg parameter is null in system code which may be effect by an external factor and an empty shopping basket). However, the partition between system and business-domain code and using different exception types seems very obvious and not making the most of custom exceptions. Related to this, if custom exceptions cover the business exceptions, I could also get all the places which are sources for exceptions at the business domain level using "Find all references". Is it worth adding exceptions if you check the arguments in a method for being null, use them a few times, and then add the catch? Is it a realistic risk that an external factor or some other freak cause could cause the argument to be null after being checked anyway? 2) What does it mean when exceptions should not be used to control the flow of programs and why not? I assume this is like: if (exceptionVariable != null) { } Is it generally good practise to fill every variable in an exception object? As a developer, do you expect every possible variable to be filled by another coder?

    Read the article

  • Properly handling possible System.NullReferenceException in lambda expressions

    - by Travis Johnson
    Here's the query in question return _projectDetail.ExpenditureDetails .Where(detail => detail.ProgramFund == _programFund && detail.Expenditure.User == _creditCardHolder) .Sum(detail => detail.ExpenditureAmounts.FirstOrDefault( amount => amount.isCurrent && !amount.requiresAudit) .CommittedMonthlyRecord.ProjectedEac); Table Structure ProjectDetails (1 to Many) ExpenditureDetails ExpenditureDetails (1 to Many) ExpenditureAmounts ExpenditureAmounts (1 to 1) CommittedMonthlyRecords ProjectedEac is a decimal field on the CommittedMonthlyRecords. The problem I discovered in a Unit test (albeit an unlikely event), that the following line could be null: detail.ExpenditureAmounts.FirstOrDefault( amount => amount.isCurrent && !amount.requiresAudit) My original query was a nested loop, in where I would be making multiple trips to the database, something I don't want to repeat. I've looked in to what seemed like some similar questions here, but the solution didn't seem to fit. Any ideas?

    Read the article

  • Handling exception from unmanaged dll in C#

    - by StuffHappens
    Hello. I have the following function written in C# public static string GetNominativeDeclension(string surnameNamePatronimic) { if(surnameNamePatronimic == null) throw new ArgumentNullException("surnameNamePatronimic"); IntPtr[] ptrs = null; try { ptrs = StringsToIntPtrArray(surnameNamePatronimic); int resultLen = MaxResultBufSize; int err = decGetNominativePadeg(ptrs[0], ptrs[1], ref resultLen); ThrowException(err); return IntPtrToString(ptrs, resultLen); } catch { return surnameNamePatronimic; } finally { FreeIntPtr(ptrs); } } Function decGetNominativePadeg is in unmanaged dll [DllImport("Padeg.dll", EntryPoint = "GetNominativePadeg")] private static extern Int32 decGetNominativePadeg(IntPtr surnameNamePatronimic, IntPtr result, ref Int32 resultLength); and throws an exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The catch that is in C# code doesn't actually catch it. Why? How to handle this exception? Thank you for your help!

    Read the article

  • Handling exception from unmanaged dll in C#

    - by StuffHappens
    Hello. I have the following function written in C# public static string GetNominativeDeclension(string surnameNamePatronimic) { if(surnameNamePatronimic == null) throw new ArgumentNullException("surnameNamePatronimic"); IntPtr[] ptrs = null; try { ptrs = StringsToIntPtrArray(surnameNamePatronimic); int resultLen = MaxResultBufSize; int err = decGetNominativePadeg(ptrs[0], ptrs[1], ref resultLen); ThrowException(err); return IntPtrToString(ptrs, resultLen); } catch { return surnameNamePatronimic; } finally { FreeIntPtr(ptrs); } } Function decGetNominativePadeg is in unmanaged dll [DllImport("Padeg.dll", EntryPoint = "GetNominativePadeg")] private static extern Int32 decGetNominativePadeg(IntPtr surnameNamePatronimic, IntPtr result, ref Int32 resultLength); and throws an exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. The catch that is in C# code doesn't actually catch it. Why? How to handle this exception? Thank you for your help! UPDATED private static IntPtr[] StringsToIntPtrArray(params string[] strs) { IntPtr[] ptrs = new IntPtr[strs.Length + 1]; for(int i = 0; i < ptrs.Length - 1; i++) ptrs[i] = StringToIntPtr(strs[i]); ptrs[ptrs.Length - 1] = Marshal.AllocHGlobal(m_MaxResultStringBufSize); return ptrs; }

    Read the article

  • SWFUpload multiple files server-side handling

    - by Chau
    I need the user to be able to upload multiple files to my server, thus I am using the SWFUpload utility. SWFUpload sends the files one by one, and I need to store them all in the same temporary directory. My ASP.NET handler recieves the files one by one and I can store the file appropriately. My problem is: How do I know which files belong to the same upload? Rephrased, how do I connect the files in my handler?

    Read the article

  • Handling Errors from HttpWebRequest.GetResponse

    - by Jason
    Hey experts - I'm having a ridiculous time trying to get an SMS API working (ZeepMobile, if you're interested) with .NET... I've been around .NET for a few years, but with all this social networking and API stuff, I need to get into the HttpWebRequest a bit. I'm new at it, but not completely new; I was able to hook up my site to Twitter without too much fuss (ie, I was able to modify someone's code to work for me). Anyways, the way their API works is to send an SMS message, you send them a POST and they respond back to you. I can send it just fine, but every time I do, rather than echo back something helpful to figure out what the error is, I get the Yellow Error Page Of Death (YEPOD) saying something to the effect of "The remote server returned an error: (400) Bad Request." This occurs on my line: '...creation of httpwebrequest here...' Dim myWebResponse As WebResponse myWebResponse = request.GetResponse() '<--- error line Is there any way to simply receive the error from the server rather than have the webserver throw an exception and give me the YEPOD? Or better yet, can anyone post a working example of their Zeep code? :) Thanks! EDIT: Here's my whole code block: Public Shared Function SendTextMessage(ByVal username As String, _ ByVal txt As String) As String Dim content As String = "user_id=" + _ username + "&body=" + Current.Server.UrlEncode(txt) Dim httpDate As String = DateTime.Now.ToString("r") Dim canonicalString As String = API_KEY & httpDate & content Dim encoding As New System.Text.UTF8Encoding Dim hmacSha As New HMACSHA1(encoding.GetBytes(SECRET_ACCESS_KEY)) Dim hash() As Byte = hmacSha.ComputeHash(encoding.GetBytes(canonicalString)) Dim b64 As String = Convert.ToBase64String(hash) 'connect with zeep' Dim request As HttpWebRequest = CType(WebRequest.Create(_ "https://api.zeepmobile.com/messaging/2008-07-14/send_message"), HttpWebRequest) request.Method = "POST" request.ServicePoint.Expect100Continue = False ' set the authorization levels' request.Headers.Add("Authorization", "Zeep " & API_KEY & ":" & b64) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = content.Length ' set up and write to stream' Dim reqStream As New StreamWriter(request.GetRequestStream()) reqStream.Write(content) reqStream.Close() Dim msg As String = "" msg = reqStream.ToString Dim myWebResponse As WebResponse Dim myResponseStream As Stream Dim myStreamReader As StreamReader myWebResponse = request.GetResponse() myResponseStream = myWebResponse.GetResponseStream() myStreamReader = New StreamReader(myResponseStream) msg = myStreamReader.ReadToEnd() myStreamReader.Close() myResponseStream.Close() ' Close the WebResponse' myWebResponse.Close() Return msg End Function

    Read the article

  • Handling redirected URL within Flex app?

    - by fortpointuiguy
    We have a Flex client and a server that is using the Spring/Blazeds project. After the user logs in and is authenticated, the spring security layer sends a redirect to a new URL which is where our main application is located. However, within the flex client, I'm currently using HTTPService for the initial request and I get the redirected page sent back to me in its entirety. How can I just get the URL so that I can use navigatetourl to get where the app to go where it needs to? Any help would greatly be appreciated. Thanks!

    Read the article

  • C# Process Exited event not firing from within webservice

    - by davidpizon
    I am attempting to wrap a 3rd party command line application within a web service. If I run the following code from within a console application: Process process= new System.Diagnostics.Process(); process.StartInfo.FileName = "some_executable.exe"; // Do not spawn a window for this process process.StartInfo.CreateNoWindow = true; process.StartInfo.ErrorDialog = false; // Redirect input, output, and error streams process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardInput = true; process.EnableRaisingEvents = true; process.ErrorDataReceived += (sendingProcess, eventArgs) => { // Make note of the error message if (!String.IsNullOrEmpty(eventArgs.Data)) if (this.WarningMessageEvent != null) this.WarningMessageEvent(this, new MessageEventArgs(eventArgs.Data)); }; process.OutputDataReceived += (sendingProcess, eventArgs) => { // Make note of the message if (!String.IsNullOrEmpty(eventArgs.Data)) if (this.DebugMessageEvent != null) this.DebugMessageEvent(this, new MessageEventArgs(eventArgs.Data)); }; process.Exited += (object sender, EventArgs e) => { // Make note of the exit event if (this.DebugMessageEvent != null) this.DebugMessageEvent(this, new MessageEventArgs("The command exited")); }; process.Start(); process.StandardInput.Close(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); int exitCode = process.ExitCode; process.Close(); process.Dispose(); if (this.DebugMessageEvent != null) this.DebugMessageEvent(this, new MessageEventArgs("The command exited with code: " + exitCode)); All events, including the "process.Exited" event fires as expected. However, when this code is invoked from within a web service method, all events EXCEPT the "process.Exited" event fire. The execution appears to hang at the line: process.WaitForExit(); Would anyone be able to shed some light as to what I might be missing?

    Read the article

  • What happens if my IExceptionPublisher throws an Exception?

    - by Graphain
    Hi, I'm using the .NET Exception Management Application Block (EMAB). As part of this I am implementing IExceptionPublisher classes. However, I am wondering what happens if these publishers encounter an Exception. I had a bit of a look around and apparently they are meant to do something like this: try { /* Normal Exception Publishing */ } catch { ExceptionManager.PublishInternalException(exception, additionalInfo); } Source: One caveat: what happens if there is an exception in our custom publisher code, preventing the publishing to MSMQ? For that, we turn to the ExceptionManager.PublishInternalException method, which will publish the exception to the default publisher, which is the Windows application event log. However, PublishInternalException is both protected and internal so I would have to be implementing ExceptionManager, not IExceptionPublisher, to access it.

    Read the article

  • SelectedIndexChanged for programmatically created dropdownlist in ASP.NET fires multiple times.

    - by Achilles
    Consider the following: dim dropdownlist1 as new dropdownlist dim dropdownlist2 as new dropdownlist dim dropdownlist3 as new dropdownlist dropdownlist1.AutoPostBack = true dropdownlist2.AutoPostBack = true dropdownlist3.AutoPostBack = true AddHandler dropdownlist1.SelectedIndexChanged, AddressOf SomeEvent AddHandler dropdownlist2.SelectedIndexChanged, AddressOf SomeEvent AddHandler dropdownlist3.SelectedIndexChanged, AddressOf SomeEvent The SomeEvent fires as expected when any of the dropdown's selection is changed. However if say DropdownList2 has a selection made then I make a selection with either DropDownList1 or DropdownList3, then SomeEvent fires again. What is causing this behavior and how do I get just a single raising of that event? I suspect that when the viewstate for the dynamcially created dropdownlists is restored and the selection restored, then the event is fired because technically the selected index did change when the control was recreated. The reason I suspect this is that the event fires the for each dropdownlist...

    Read the article

  • "Randomly" occurring errors...

    - by ClarkeyBoy
    Hi, My website has a setup whereby when the application starts a module called SiteContent is "created". This runs a clearup function which basically deletes any irrelevant data from the database, in case any has been left in there from previously run functions. The module has instances of Manager classes - namely RangeManager, CollectionManager, DesignManager. There are others but I will just use these as an example. Each Manager class contains an array of items - items may be of type Range, Collection or Design, whichever one is relevant. Data for each range is then read into an instance of Range, Collection or Design. I know this is basically duplicating data - not very efficient but its my final year project at the moment so I can always change it to use Linq or something similar later, when I am not pressured by the one month deadline. I have a form which, on clicking the Save button, saves data by calling SiteContent.RangeManager.Create(vars) or SiteContent.RangeManager.Update(Range As Range, vars) (or the equivalent for other manager classes, whichever one happens to be relevant). These functions call a stored procedure to insert or update in the relevant table. Classes Range, Collection and Design all have attributes such as Name, Description, Display and several others. When the Create or Update function is called, the Manager loops through all the other items to check if an item with the same name already exists. The Update function ensures that it does not compare the item being updated to itself. A custom exception (ItemAlreadyExistsException) is thrown if another item with the same name is found. For some weird reason, if I go into a Range, Collection or Design in edit mode, change something and try to update it, it occasionally doesnt update the item. When I say occasionally I mean every 3 - 4 page loads, sometimes more. I see absolutely no pattern in when or why it occurs. I have a try-catch statement which catches ItemAlreadyExistsException, and outputs "An item with this name already exists" when caught. Occasionally it will output this; other times it will not. Does anyone have any idea why this could happen? Maybe a mistake which someone has made and solved before? I used to have regular expressions in place that the names were compared to - I believe it was [a-zA-Z]{1, 100} (between 1 and 100 lower- or upper-case characters). For some reason the customer who I am developing the site for used to get errors saying its not in the correct format. Yet he could try the same text 5 minutes later and it would work fine. I am thinking this could well be the same problem, since both problems occur at random. Many thanks in advance. Regards, Richard Clarke Edit: After much time spent narrowing down the code, I have decided to wait till my brother, who has been a programmer for at least 8 years more than I have, to come down over Easter and get him to have a look at it. If he cant solve it then I will zip the files up and put them somewhere for people to access and have a go at. I narrowed it down literally to the minimum number of files possible, and it still occurs. It seems to be about every 10th time. Having said that, I force the manager classes to refresh every 10 page loads or 5 minutes (whichever one is sooner). I may look into this - this could be causing a problem. Basically each Manager contains an array of an object. This array is populated using data from the database. The Update function takes an instance of the item and the new values to be set for the object. If it happens to be a page load where the array is reset (ie the data is loaded freshly from the database) then the object instance with the same ID wont be the same instance as the one being passed in. This explains the fact that it throws an ItemAlreadyExistsException now and then. It all makes sense now the more I think about it. If I were to pass in the ID of the object to be altered, rather than the object itself, then it should work perfectly. I will answer the question if I solve it..

    Read the article

  • MVVM/ViewModels and handling Authorization

    - by vdh_ant
    Hey guys Just wondering how how people handle Authorization when using MVVM and/or View Models. If I wasn't using VM's I would be passing back the Model and it would have a property which I could check if a user can edit a given object/property but when using MVVM I am disconnecting myself from the business object... and thus doen't know what the security should be any more. Is this a case where the mapper should be aware of the Authorization that is in place and don't copy across the data if the Authorization check fails. If this was the case I am guessing that the mapper would have to see some properties on the VM to let the interface know which fields are missing data because of the Authorization failure. If this does occur within the mapper, how does this fit in with things like AutoMapper, etc. Cheers Anthony

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >