Here you’ll find the actions run during a typical request in the backend admin area.

muplugins_loaded
registered_taxonomy
registered_post_type
load_textdomain
plugins_loaded
sanitize_comment_cookies
setup_theme
after_setup_theme
auth_cookie_valid
set_current_user
init
widgets_init
wp_register_sidebar_widget
update_option
update_option__transient_doing_cron
updated_option
set_transient__transient_doing_cron
setted_transient
http_api_debug
admin_bar_init
add_admin_bar_menus
delete_option
delete_option_rewrite_rules
deleted_option
add_option
add_option_rewrite_rules
added_option
wp_loaded
auth_redirect
_admin_menu
admin_menu
deprecated_argument_run
admin_init
current_screen
load-index.php
add_site_option
setted_site_transient
wp_dashboard_setup
do_meta_boxes
admin_enqueue_scripts
admin_print_styles-index.php
admin_print_styles
admin_print_scripts-index.php
admin_print_scripts
wp_print_scripts
admin_head-index.php
admin_head
adminmenu
in_admin_header
wp_before_admin_bar_render
wp_after_admin_bar_render
admin_notices
all_admin_notices
welcome_panel
right_now_content_table_end
right_now_table_end
right_now_discussion_table_end
rightnow_end
activity_box_end
media_buttons
wp_enqueue_media
posts_selection
in_admin_footer
admin_footer
print_media_templates
admin_print_footer_scripts
before_wp_tiny_mce
after_wp_tiny_mce
admin_footer-index.php
shutdown

Edit your wp-config.php file, located in WordPress root folder, and add or replace define('WP_DEBUG', true);

In this way, WordPress will print the logs on the screen. This may be very annoying, so you would like to redirect all logs in a file.

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true );
define('WP_DEBUG_DISPLAY', false );
ini_set('display_errors', 0 );

// By default, WordPress write the logs in /wp-content/log/debug.log
// comment out the line below to change path and log filename
//ini_set( 'error_log', '/path/site.com/wp-content/logs/debug.log' );

As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

MySQL provides a very simple method to select rows in random order. It uses the ORDER BY RAND()statement. If you will be used theORDER BY RAND() statement, MySQL will create a temporary table with all results, then will be assigned a random index to each row and finally will return the random rows! This makes the ORDER BY RAND() quite slow. In fact, some developer prefers alternative techniques, such as PHP random functions or special SQL select.

Read More

When you would like to show a page only for a specified user or you wish to create a maintenance page, you may use this simple script:

// List of allowed IP addresses
$allowIP = array("87.6.45.33", "234.34.34.2"); // etc...

// Access denied
if( !in_array($_SERVER['REMOTE_ADDR'], $allowIP ) {
  // include maintenance mode
  die();
}

// Access grant and display the rest of view

With Xcode 4 you can develop applications for iPad and iPhone. Also, you can choose a different iOS target. Currently, the last release of iOS is 4.3 and when you will create a new project you will see:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // Override point for customization after application launch.
  self.window.rootViewController = self.viewController;
  [self.window makeKeyAndVisible];
  return YES;
}

Now, the rootViewController property has been added with iOS 4. This means that when we going to test the application in iOS 3.2 environment we will get a CRASH! Instead of check the iOS version, we can use a feature of Obejctve-C in order to check if a property exists:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // Override point for customization after application launch.
  if ([self.window respondsToSelector:@selector(setRootViewController:)]) {
    self.window.rootViewController = self.viewController;
  } else {
    [self.window addSubview:self.viewController.view];
  }

  [self.window makeKeyAndVisible];
  return YES;
}

As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

The last version of WordPress provides a new toolbar in frontend view when you are logged in. To disable this feature you can add the following code in the functions.php file in your active theme:

// Before check if the filter show_admin_bar exists
if( has_filter('show_admin_bar') ) {
  add_filter( 'show_admin_bar', '__return_false' );
}
Read More

Apple suggests using an instance of NSFileManager class and avoid the static class method defaultManagerbecause it will return a singleton instance: no thread-safe:

In Mac OS X v.10.5 and later you should consider using [[NSFileManager alloc] init] rather than the singleton method defaultManager. Using [[NSFileManager alloc] init] instead, the resulting NSFileManager instance is thread safe.

For example:

// bad
BOOL result = [[NSFileManager defaultManager] fileExistsAtPath:pathLocalRepository isDirectory:nil];

// good
NSFileManager *fm = [[NSFileManager alloc] init];
BOOL result = [fm fileExistsAtPath:pathLocalRepository isDirectory:nil];
[fm release];
fm = nil;

If you  would like to avoid to set the background image of the main view controller through Interface Builder, you can use a different way and delete the UIImageview object from Interface Builder:

- (void)viewWillAppear:(BOOL)animated 
{
  [super viewWillAppear:animated];
  self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundImage.jpg"]];
}

You may use viewDidLoad as well but viewWillAppear avoid some flickering. With Xcode 3.2.5 is not possible to use the pattern yet.

How to check if an element DOM exists

Be careful when you wish if an element DOM exists. If you use:

if ( $("#my-id") ){
  // exists?
}

This method doesn’t work because jQuery will return an [Object object] even if the element doesn’t exist. We may use a couple of methods to be sure that an element exists:

Read More