handling

javascript - dom searching for id returns an error - how to handle?

for (i=1; i<=4; i++) { try { timer = document.getElementById("timer"+i).parentNode.parentNode.parentNode.childNodes[1].childNodes[0].childNodes[0].className; } catch(e) { FM_log("aguardaReforcos()", "ERRO - timer"+i); } ... I have to it this way with try because otherwise I get...

Saving PHP's memory state if an error occurs.

Hi, I'm curious if anyone knows how I can save the current state of a php application (the one that is currently in memory, with everything including declared variables, $_POST, $_GET) when an error occurs? Currently Zend Server does this. by monitoring the application and saving the snapshot of the php's memory etc. and shows a log r...

Preventing Windows shut down

To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below: TForm3 = class(TForm) private procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession; end; and the implementation procedure TForm3.WMQueryEndSession(var Msg: TWM...

Whats the right approach for error handling in C++

One is to use C++ exceptions: try catch blocks. But freeing dynamic memory will be an issue when an exception is raised. Second is to use C style: errno variable Third is just to return -1 on error and 0 on success :) Which way should be chosen for a mid-size project and why? Any other better approach..? ...

Least memory intensive way to read a file in PHP

I am reading a file containing around 50k lines using the file() function in Php. However, its giving a out of memory error since the contents of the file are stored in the memory as an array. Is there any other way? Also, the lengths of the lines stored are variable. @gordon : Here's the code. Also the file is 700kB not mB. private...

Design pattern for shared error handling code

I'm looking for some thoughts/opinions on architecture for a layer of code that invokes methods in an API. In my case, the calling code is C#/.NET and the API is part of an unmanaged legacy DLL. But the same question could apply in many different languages/environments. I'm basically writing a managed wrapper around an unmanaged API. ...

PHP custom error handling: an error in one page affects users browsing other pages.

I have a custom PHP error handler in my application, which displays a friendly error message to the user and logs the error for me to fix. However, I've noticed since implementing it that when an error occurs in one page, the error is reported from users on unrelated parts of the site. Say it's a error in /some_site_section/view_one.ph...

Perfect circle to perfect circle and Perfect circle to straight line collision HANDLING in Java

I am a newbie at Java, but decided to make a application that has a bunch of balls bouncing around. Please keep in mind that I know almost nothing about normals, which I have seen mentioned a lot in this kind of thread. I have also only take Algebra 1, and know a little bit of trig (sin, cosin and tangent). Anyways... I have collision d...

Error Handling Not working ASP .NET MVC

Hello, I have created a new MVC Application in VS2010 straight out the box. In the Home Controller I have ther following: [HandleError(View = "Error")] public ActionResult Index() { int num1 = 0; int num2 = 5; int result = num2 / num1; return View(); } This creates an error and a d...

Global Error Handler for Flash Player 10.1 not working

Trying to implement the new FP 10.1 Global error handler into my projects but no matter what I do any uncaught error will still show up the Exception window (both in debug and release versions of the SWF). All I want to do is to prevent these popups but instead send a message to my logger. Here's my code ... EDIT: I simplified the code ...

Handling a class that doesn't throw exception in c#

I've got some UI code that looks like this: try { SomeClass classInstance = new SomeClass(someId); } catch (Exception exception) { // Content wasn't created, show a message, stop processing return; } It seems the try catch was added because the constructor for SomeClass would bomb out if the someId it receives isn't valid,...

How to handle < and > symbols in HttpService if we use xml as a result format ?

I used a httpservice which returns a xml as a result.But the content itself has a '<' symbol or '>' symbol , it leads to error ! How can i handle this? Thanks in advance. ...

US and UK based site how to handle

We have 2 sets of prices, $ and £'s. How best can I handle this. Should I have a folder with the US site in so when users click on the US flag they go to mydomain.com/us and then navigate from there. Or is there something simpler I can do? The HTML site passes users over to our client system when ordering so currency conversion etc i...

Event handling in modal windows (Java swing)

I'm developing the Java Swing application. I'm quite new to Java, so got some questions. I have a modal window with some set of controls (text fields, buttons etc). I want to handle click on the button in the parent window. I think the most efficient and accurate way is first to handle it in modal window, then raise some another event ...

Handling Optional APIs in J2ME

What is the right way of working with optional APIs in Java Mobile? Does one need to make different versions of their app? Or is it enough to check APIs availability at runtime using System.getProperty()? Let's say I'd like my app to support JSR-256 (the Sensor API). Would importing classes from javax.microedition.sensor and register...

Using a lib with enabled exception handling in an application where exception handling is turned off

Hi all, This question is about a C++ library for Windows and we use Visual C++ as our compiler. We enable exception handling compiler option in our library. We also use throw/catch in a few places. One of our customers says that they disable exception handling option in their application. Now the question is, whether they would exper...

Catching IIS-level certificate errors in C# code

I'm making a SOAP handler that will be secured with X509 Certificates, and one of the requirements is that the program log as much as possible in an existing log viewer. Obviously, there are a lot of errors surrounding certificates that are handled at the IIS level, which in this case is not acceptable. I already have the logging part ...

ASP.NET - Error/Exception Handler (looking for some project)

Hi I'm newbie when talks about Error Handling. It's a subject that i want to study but right now i just don't have free time, so i'm looking to implement an error/exception handler one a few projects i've developing last weeks (C#, .NET 3.5). What do you recommend me to implement for this? Other point is where to store the errors logs....

More professional error handling.

I have a contact form and I handle errors by checking each field one-by-one with an "if" statement. I find this hard and I can't seem to find a better/more productive way to get them working. I would also like a heading saying "Error" if one (or more) is true. But I cant get them to work with the separate "if" statements. Here is my cod...

istream not working in DEV C++

Hi. I'm using ifstream and ofstream operations in DEV c++ but they don't seem to work correctly. I've been trying to write a little prime generator code but it doesn't work :\ When I display fstream::tellg() at any point, it displays -1. Please check the code. Thanx. #include<iostream> #include<math.h> #include<fstream> using namespace ...