Carrots

These are from my parents garden..

Img_0006 Img_0008 [See the full gallery on Posterous]5

more ...





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 ...