Email php errors

This has been very useful code for me, so I thought I would share it, maybe somebody else also find it useful:

// Register handlers
set_error_handler('custom_error_handler', E_ALL);
set_exception_handler('custom_exception_handler');
register_shutdown_function('send_php_errors');

// Array containing errors
$php_errors = array();


// Error handling function
function custom_error_handler($errno, $errstr)
{
  global $php_errors;
  $php_errors[] = func_get_args();
  return FALSE;
}


// Exception handling function
function custom_exception_handler($exception)
{
  global $php_errors;
  $php_errors[] = (array)$exception;
}


// Send php errors on shutdown
function send_php_errors()
{
  global $php_errors;
  if (!empty($php_errors))
  {
    mail('Place your e-mail here', '!!! PHP error !!!', print_r($php_errors, TRUE), "Content-Type: text/plain; charset=utf-8");
  }
}
more ...



iPhone navigation back button

It turns out, that navigation bar back button is set from parent controller that pushed new view controller. So if you want to hide back button you have to hide it in first view controller and then push the new one.

But if you have many places where you need to push new view controllers and have back button, but only one place where it needs to be set it is not very efficient to set it every time to not hidden. The solution is this code called from view controller pushed:

[self.navigationController.parentViewController.navigationItem setHidesBackButton:YES];

Don't forget to show it when view disapears.

It also applies to custom back buttons - you have to apply it to first view controller, not the one is being pushed on.

more ...

Comparing posterous and google analytics statistics

Of course I would like to have my site viewed as much as posterous says, but I think I can be sure, that google analytics is more correct. Anyway difference ir very large so I assume, that posterous don't filter any kind of requests. I mean search engines, and so on.

Screen_shot_2011-03-23_at_3 Screen_shot_2011-03-23_at_3 [See the full gallery on Posterous]5

more ...

Why I don't want to buy new macbook pro?

I do want to have it, because I have 3 years old macbook white, but there are things keeping me away from buying it. Basically these things that came with new macbook pro are not so important to replace the old one.

Lets start with features new macbook pro has, but they can't buy me.

Thunderbolt. The speed seems amazing (10 Gbps), but most probably the first time I will use it will be after some 5 years, as I am not compressing and storing any big video files, images, etc.

Faster, better video card. Cool to have it, right? But in real world I don't see any downside of the one I currently have. Really I haven't seen any problems that could apply to video card. I am not playing games very much..

Next-generation quad-core and dual-core Intel processors. This is also pretty cool, and actually sometimes I feel like my old macbook could be little faster, especially when I started learning iPhone development. But it is not like the current 2.4 GHz CPU is lagging.

Battery. My …

more ...


Code Cards v1.2

I just wanted to mention, that since yestereday Code Cards 1.2 have been approved and is available on App Store.

This update took 3 days to process. Nice work Apple. :)

P.s. This is more like a bug fix version.

more ...

iPhone and Andorid development

This has been a very busy month. I even don't know where to start. Yes, I have made an iPhone app and it is published, but lets start with one other thing.

Besides my day job I have started to work for a new, amazing startup called "Fracture" (http://www.fractureme.com/ ). Currently it is more like a freelancer job for various tasks. As I already mentioned it is a new startup run by Alex Theodore and Abhi Lokesh. The whole story about how the idea showed up and on you can read in About section, if you are interested. What they do is, they print pictures on a glass. Then they put a simple handling hole behind it, pack it in a very resistant package and ship it to you. They will even add a screw so you can put it on the wall right away. We ordered one fracture as an example and it was so cool so I decided to apply for php position there. They agreed and in this little time I have learned some new …

more ...

Classics

Today I woke up with classics dinging my mind. This one somehow represents my mood today:

more ...