errors

php: how to return an HTTP 500 code on any error, no matter what

Hi guys. I'm writing an authentication script in PHP, to be called as an API, that needs to return 200 only in the case that it approves the request, and 403 (Forbidden) or 500 otherwise. The problem I'm running into is that php returns 200 in the case of error conditions, outputting the error as html instead. How can I make absolutel...

Headers already sent error in CakePHP app

function new_photo() { if( !empty($this->data)) { $this->data['Photo']['showcase_id'] = $this->Session->read('CurrShowcase.id'); $this->data['Photo']['added'] = date("Y-m-d H:i:s"); $this->Showcase->Photo->save...

How many gumballs in the jar. 2 errors

Trying to code a guess how many gumballs in the gumballs jar, kinda thing. There are two problems I keep getting: It's supposed to say if the guess is to high or to low but that only happens when i enter a number over 1000 and it says: Enter your guess: 1001 Too High! Too Low! Enter your guess: If you type a letter or phrase it go...

I get this error! [ 'return' statement outside of function ]

I was creating a form validator for a client and ran into this weird error ONLY in Internet Exploder (Explorer) 7/8.... 'return' outside of function, line 1, char 1 Of course, there was no code whasoever on line 1, it was a simple commented statement. And there was nothing wring with it in any way. So I knew it was just a debug miss-di...

Problems with Eclipse (and m2eclipse)

Hi guys, I use Eclipse and I have serious problems :-( First I try to reconstruct my situation rudely for you: I installed Eclipse JEE Helios and JDK 1.6.0_21 and configured windows' system vaariables I installed m2eclipse I generated an archetype for a JSF Webproject I use Windows XP Professional SP3 So... now Eclipse has very bi...

Under Codeigniter, is it possible to see mysql_error()?

I have an Codeigniter app (latest version of CI) that is writing a transaction to a mysql database. I'm fairly sure that I've got a foreign key constraint error occurring, but I can find no way to make CI tell me the specific error. mysql_error() comes back empty. Can anyone tell me how to get Codeigniter to tell me the myslq error mess...

Has anyone got any experience using Pfeed? I have several issues to build up a 'recent activity' log.

Hi there, I have started trying to use Pfeed plugin for my Rails app. Apart from four support pages of wiki on the Github, I only found this blog post helpful for me to start using. I have managed to get the simple feeds working like "User bought 12 items about 1 minute ago" etc. But when it comes to customize the feed items, that's w...

Using PHP to request errors information and post if errors has anything

Hi everyone, I have an HTML form that takes inputted data and sends it via the mail() function. I also have some validation techniques that validate the inputs, and I created an array variable $errors to log all of the errors; for example, if the name was left empty, $errors[]="Name empty"; If the email was left empty, $errors[]="email...

XCode is not building my application because of some random thing.

I have no idea what this error is about, the deadline for that application is tomorrow. I have no idea what is it about but it is refusing to compile. It is a giant project with over 150 source files and with about 20 3rd party dependencies. Internal error occurred while creating dependency graph: -[PBXTargetBuildContext ]: unrec...

How to handle File Server unavailable errors

I need to know how to recover from the following error: Windows service is accessing a file on a network server. The network crashes, server goes down or becomes unavailable. I need the service to wait until the server is back on line to continue processing the files. What should I use to do this? I figure I can trap the server un-avail...

How to tell when a PHP Fatal Error is really a veiled Syntax Error, and when do they happen?

Considering the following PHP class: class someObject { public function broken(){ return isset($this->something()) ? 'worked' : 'didnt'; } public function something(){ return true; } public function notBroken(){ print('worked'); } } Let's say I now do: $obj= new someObject(); $obj->br...

Ruby's Exception Error classes

You can create a subclass of an exception to make it more descriptive, but how should you set the default 'message'? class MyError < StandardError # default message = "You've triggered a MyError" end begin raise MyError, "A custom message" rescue Exception => e p e.message end begin raise MyError raise Exception => e p e.mes...

In flash AS3 How to put single try catch code, in order to catch any errors in whole class?

Hi all, In Flash AS3 i wanna write the single try catch block in order to catch any errors in whole class. For ex, i have a lot of functions in myClass.as. I don'w wanna write in each function try catch blocks in order to catch errors in this function. Is there any methods to do this? Thank you ...

PHP handle errors

Using this code with simplehtmldom script (http://simplehtmldom.sourceforge.net/manual.htm): function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } $url = 'http://site.com/'; $html = file_get_html($url); How to ...

Using variables to check for error condition in Javascript

Hi all, I have a personal simple jQuery validation script. It works when the submit button is clicked and sets up a variable: $errors = false; Then there are series of if statements that check for textbox values and conditions, and if conditions are not met, variable $errors is set to true. The script works except for one thing. If a...

mysql_fetch_array & num_rows errors-Help!!!!!

Can anyone tell me why I am recieving these errors when I do this??? Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\login\index.php on line 63 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\login\index.php on line 65 When I do this:: $...

How to return errors to view from controller not tied to a specific model property

Curious what the best practice is for returning errors to a view from a controller where the error isn't really a validation error, but more like "user not found" or "service timeout" type of errors. (in ASP.NET MVC2 framework) I've been adding them to the ModelState's model errors, but that doesn't seem appropriate. (although easy to i...

Logging a phantom error in production for android!?

Hello All! I have an android application that runs well on my emulator, but when i deploy the .apk to a real phone, it works for about 4-5 minutes and then unexpectedly crashes. Is there anyway I could get a stack trace or more helpful information to show up on the android when it does this? Any particular way to get a log? And also, ...

Retrieve all Data Bindings from WPF Window

I have a WPF form which has many controls on it. Many (but not all) of these controls are databound to an underlying object. At certain times, such as when the Save button is pressed, I need to check all the validation rules of my controls. Is there a way to do this programatically, WITHOUT hard-coding a list of the controls to be val...

Explanation of 'global symbol requires explicit package name'

I've been learning Perl and whenever I write a non-trivial script I always get this error message. I always think I have a good understanding of it, but I suppose I don't. Here is a sloppy markov chain example (not tested) with the errors below. The #!/usr/bin/perl -w use strict; sub croak { die "$0: @_: $!\n"; } sub output { my...