Ad_Feed

Friday, January 20, 2017

Warning Messages in "R" on Mac.

 When starting R (or using any IDE like RStudio), the following warning messages are displayed:
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_PAPER failed, using "C"
 To clear this error message, following the steps below:
  1. Open terminal and enter:
    defaults write org.R-project.R force.LANG en_US.UTF-8
  2. Restart R or R-studio.

Wednesday, December 30, 2015

How to backup multiple Mysql databases and automatically delete

The script below was adapted from iHRIS Backups (http://wiki.ihris.org/wiki/Backups) which was designed to backup one database. The script below will backup all databases in Mysql.

There is the option to remove database backup files older than 7days except from the first day of the month.


#!/bin/sh
MHOST=localhost
MUSER=db_username
MPASS=db_password
BACKUPDIR=/db/backup/dir

MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"

SUFFIX=`date +%F`
cd $BACKUPDIR

echo "Run MySQL backup"
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
    $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db > backup_${db}_${SUFFIX}.sql
    bzip2 -f backup_${db}_${SUFFIX}.sql
done
## Uncomment the following line to remove backup files older than 7 days except from the first day of the month.
#find $BACKUPDIR -name "backup_*.sql.bz2" -mtime +7 -not -name "backup_*-01.sql.bz2" -exec rm {} \;


Save the file, and ensure the script is executable using the command chmod a+x newfile.


Saturday, February 28, 2015

MySQL Databases - Commandline Backup and Restore

  • Backup A Single Database
    mysqldump -u root -p dbname > dbname.sql

    Where:
    dbname     = is the name of the database to backup
    dbname.sql = is the name of the backup file, can also be location of backup file

  • Restore A Single Database
    mysqldump -u root -p dbname < dbname.sql
  • Backup All Databases
    mysqldump -u root -p --all-databases > All-dbname.sql
  • Restore Single Database from All Database Backup
    mysql -u root -p --one-database dbname < All-dbname.sql

Tuesday, October 28, 2014

Perl warning Setting locale failed in Ubuntu

Perl Locale Warning.
The warnings could be irritating, especially when installing any application. The warnings are also visible when some commands are run

The warnings look like:
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

 
and when you run Run locale from the commandline
bonkhi@sparda-coven:$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_NG.UTF-8
LC_TIME=en_NG.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_NG.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_NG.UTF-8
LC_NAME=en_NG.UTF-8
LC_ADDRESS=en_NG.UTF-8
LC_TELEPHONE=en_NG.UTF-8
LC_MEASUREMENT=en_NG.UTF-8
LC_IDENTIFICATION=en_NG.UTF-8
LC_ALL=

To solve this, generate the missing locale
locale-gen en_US.UTF-8

Set the missing locale
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

Friday, October 3, 2014

How do you reset the circuit protection on Yamaha RX-v373?

Yamaha RX-V373 AV receiver's protection circuity is activated when there is fluctuation in power three (3) consecutive times. This protection mode disables the capability to "turn on" the device.

To disable this:

Hold "Info + Tone Control + Straight" for at least five seconds, while still holding, press the "Power" button.

Manually reboot the AVR for normal operation.

Wednesday, May 15, 2013

Using Php 5.3 on Cpanel platform

To install applications that require a higher PHP version, create a .htaccess file inside the application directory and specify which version of php you want used.


# Use PHP 5.3
AddType application/x-httpd-php53 .php