Posts

Drupal reset cron

// Delete cron with PHP  $num_deleted = 0; $num_deleted = db_delete('variable')           ->condition('name', 'cron_semaphore')           ->execute(); $num_deleted += db_delete('variable')           ->condition('name', 'cron_last')           ->execute(); if ($num_deleted > 0)         echo "Cron cleared. Clear cache!"; -- // Delete flood with PHP  $num_deleted = 0;         $num_deleted = db_delete('flood')           ->execute();     if ($num_deleted > 0)         echo "Flood cleared."; -- // Delete cron with SQL DELETE FROM `variable` WHERE name = 'cron_semaphore'; DELETE FROM `variable` WHERE name = 'cron_last'; // And CLEAR CACHE before running cron again.

Mac OSX Cannot empty trash because item is in use

Cannot empty trash because item is in use System Relaunching finder from "force quit applications" (command+option+esc) seems to work just as well.

Programmatically creating missing content profiles with default values bypassing validation

$sql = "select u.uid, u.name from users u where u.uid not in (select n.uid from node n where n.type='profile')"; $result = db_query($sql); while ($data = db_fetch_object($result)) { $node = array(); $node['type'] = 'profile'; $node['name'] = 'Profile'; $node['status'] = 1; $node['format'] = 0; $node['comment'] = 0; $node['promote'] = 0; $node['sticky'] = 0; $node['uid'] = $data->uid; $node['title'] = $data->name; $node = (object)$node; $node->field_cck1[0]['value'] = 1000; $node->field_cck2[0]['value'] = 100; $node->created = time(); $node->validated = TRUE; node_save($node); }

mysql repair table

Drupal Error : Table 'watchdog' is marked as crashed and should be repaired in /includes/database.mysqli.inc SQL query: REPAIR TABLE `watchdog` Or from phpMyAdmin : 1. Login to phpMyAdmin 2. Choose the affected database. If you only have one database, it should choose it by default so you don't need to do anything. 3. In the main panel, you should see a list of your database tables. Check the boxes by the tables that need repair. 4. At the bottom of the window just below the list of tables, there is a drop down menu. Choose "Repair Table"

drupal 6x - moving back from image cck to userpic

If you ever used image cck for user pictures and need to move back to the default built-in user pictures functionality, use this to migrate your data update users u, content_type_profile c, node n, files f set u.picture = f.filepath where f.fid=c.field_profpic_fid and c.nid = n.nid and n.uid = u.uid

Android power user codes

*#*#4636#*#* This code shows following 4 menus on screen: Phone information Battery information Battery history Usage statistics *#*#7594#*#* This code can be used to change the "End Call / Power" button action in your phone. *#*#273283*255*663282*#*#* This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo. *#*#197328640#*#* This code can be used to enter into Service mode. You can run various tests and change settings in the service mode. WLAN, GPS and Bluetooth Test Codes: *#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* - WLAN test (Use "Menu" button to start various tests) *#*#232338#*#* - Shows WiFi MAC address *#*#1472365#*#* - GPS test *#*#1575#*#* - Another GPS test *#*#232331#*#* - Bluetooth test *#*#232337#*# - Shows Bluetooth device address *#*#8255#*#* This code can be used to launch GTalk Service Monitor. Codes to get Firmware version information: *#*#4986*2650468#*#* - P...

Split and then join a file on linux - for email backup etc

On OSX terminal ssh to centos Split: split -b 25000000 -d httpdocs.tar.gz httpdocsgz (gmail does not accept attachments over 25M) Mail: echo "site backup" | mutt -s "site backup0" -a httpdocsgz00 xyz@gmail.com echo "site backup" | mutt -s "site backup0" -a httpdocsgz01 xyz@gmail.com etc Join back: cat httpdocsgz* > httpdocs.tar.gz (after downloading)