register emails are not sent to user

In case email notification after registration do not work - just check sendmail status by:


sudo service sendmail status

if status not started run it by:


sudo service sendmail restart

May 29, 2018

best drupal debug

drupal_set_message is not suitable for debugging when there is need to debug vars before the actually page action happen, thus not rendered in HTML. The most convinient way is to use:


error_log(var_export($var_to_debug, TRUE));

Then just look into the error log:


tail -f error_log

May 29, 2018

Startup and Kano model

Every entrepreneur starting his own business, startup company, a simple web service is faced with the project planning. Under project planning I mean which features should be implemented per your priority - the task is harder as you already announced beta version and have a lot of user feedback, sometimes contrary to each other. Now you have a list of the features, bugs, proposals and you want to measure the list with a metrics of severity, cost-effectiveness, time, UX-requirements - to have best plan to achieve your goals and economize investments.

May 29, 2018

The selected file /tmp/file*** could not be uploaded, because the destination * is not properly configured

The selected file /tmp/file*** could not be uploaded, because the destination * is not properly configured.

Main problem is that on shared or VPS hosting those directories: files/ tmp/ do not have proper owner and chmod settings:


chown apache:apache tmp
chmod 750 tmp

May 29, 2018

Drupal bulk delete nodes per filter


<?php
error_reporting(E_ALL);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$nodetype = "nodetype";
$uid = 1468;
$limit = 500;
$results = db_query("SELECT nid FROM {node} WHERE type='%s' AND uid=%d LIMIT %d", $nodetype, $uid, $limit);

$count = 0;

while ($result = db_fetch_object($results)) {
node_delete($result->nid);
print 'Deleted node: ' . $result->nid . '';
$count++;
}

print "Total deleted: $count";

?>

May 29, 2018

Remove ^M characters at end of lines in vim

Remove ^M characters at end of lines in vim

To remove the ^M characters at the end of all lines in vim, use:

:%s/^V^M//g

The ^v is a CONTROL-V character and ^m is a CONTROL-M. When you type this, it will look like:

:%s/^M//g

May 29, 2018

Error accessing home page of phpMyAdmin 2.8.1

Error accessing home page of phpMyAdmin 2.8.1

Warning: session_write_close() [function.session-write-close]: open(C:\DOCUME~1\user\LOCALS~1\Temp\php\session\sess_orpi7es4n3h62bk9f0sul5raj5, O_RDWR) failed: No such file or directory (2) in D:\wwwroot\phpmyadmin\index.php on line 44

May 29, 2018

Fast and easy MySQL backup and recovery with shell command

Quick backup and restore of the MySQL database using mysqldump and gzip utility:

Backup:

mysqldump -u <user> -p<password> <database_name> | gzip -9 > database_dump.sql.gz

Recovery:

gunzip < database_dump.sql.gz | mysql -u <user> -p<password> <database_name>

May 29, 2018

How to print array in Drupal using drupal_set_message

Problem:
How to print array in Drupal using drupal_set_message

Solution:

drupal_set_message('<pre>'. print_r($array_or_object, TRUE) .'</pre>');

May 29, 2018

How to remove all emails from inbox

Problem
Problem occurs when inbox is overloaded. I can not login into webmail to delete all messages.

Solution
1. ssh to the host
2. cd /var/qmail/mailnames/domain.com/webmaster/Maildir/cur
3. remove all files by command: find . -name '*' | xargs sudo rm
4. Inbox is empty

May 29, 2018

Pages