Thursday, June 16, 2011

Truncate all tables in SQL

Here is how to truncate all tables

EXEC [sp_MSforeachtable] @command1="TRUNCATE TABLE ?"

Thursday, April 21, 2011

How to find files and move the files to folder in Linux

locate *.zip | grep backup | grep accountname | xargs -t -i mv {} /home/accountname/dump/

This will find all the zip files with the name consist of backup and accountname and then move them to a dump folder.

Thursday, December 9, 2010

Moodle lose some of the administrative privilege

You are playing with roles specially admin privilege or user privilege and you end up locking your self because of the wrong configuration. To restore it back to normal, you need to go to the database and find mdl_role_capabilities table and do a search for permission |= -1 and you will see the value of -1000. Just change the value to 1 for all the -1000.

Monday, September 27, 2010

Questionnaire Export CSV Issue

You're trying to export questionnaire responses to csv format and there are missing response on one or more columns. Check the question name for that missing column and rename it with something else. It's probably a general name such as ID or Full name that interfere with the moodle general field name.

Tuesday, March 23, 2010

Mysql trick show tables

mysql databasename -u [root] -p[password] -e 'show tables like "wp_153_%"' | grep -v Tables_in
| xargs mysqldump [databasename] -u [root] -p[password] > [target_file]

Tuesday, November 24, 2009

Removing IP manually after created by Cpanel

Go to /etc/ips
and remove the line with the IP you want to remove.

Other way to add multiple IPs on a non cpanel is
Go to /etc/sysconfig/network-scripts/
Then add ifcfg-eth0:1 with different ip.

For example
DEVICE=eth0:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.18.0.15
NETMASK=255.255.0.0

Saturday, October 17, 2009

Unicode error warning red message

To fix this, we need to alter the database using this command

ALTER DATABASE `dbname_moodle` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;