1/28/2017

Find files containing text and remove them

Find files containing text and remove them

$ find . -type f -exec grep -q search_term {} \; -exec rm {} \;

12/04/2016

Configure the subversion server on centos

Now you can follow the steps to create subversion server.

1. Install httpd

     # yum -y install httpd
     # service httpd start

     # chkconfig httpd on

2. Install subversion

     yum -y install subversion mod_dav_svn
     # mkdir /var/local/svn

3. Configure subversion

     # vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/local/svn
</Location>

4. Create on repos

# svnadmin create /var/local/svn/sample
# chown -R apache:apache /var/local/svn/sample

5. Confirm the repos

Browser 
http://example.com/repos/sample/

Output
repos - Revision 0: /

6. Ip permission

# vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/local/svn

+   Order deny,allow
+   Deny from all
+   Allow from xx.xx.xx.xx
</Location>

7. Basic authentication

# vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/local/svn

+   AuthType Basic
+   AuthName "Authorization Realm"
+   AuthUserFile /etc/httpd/passwd/svn-users
+   Require valid-user
</Location>

8. Create authentication file

# htpasswd -c /etc/httpd/passwd/svn-users svn-user-name

9/08/2015

Prevent form submit from submiting multiple times by jQuery

If you need to assign a click function dynamically, there is a way to ensure the click function is only assigned once and not duplicated.


Now I show one way based on jquery




       
                        # test
            if ($_POST) {
                print_r($_POST);
                $loop = 100000000;
                for ($i = 0; $i < $loop; $i++) {
                    $b+=1;
                }
                echo 'Completed';
            }
            ?>
        


       

           

           
       



   

       

8/27/2015

How to avoid your div blocked by ad blocker in browser

Please do not use the following names as the class name or id name of css
in your website.

Now ad blocker plugin of many browser will block the following name in your contents, such as
  • AdBlock
  • Adblock Plus
  • AdBlock extension
  • Adblock Plus extension
  • Ad Blockers for Chrome, Firefox, and Safari
The list of rules for ad blocker

#boxes-box-zergnet_module,
 #zergnet,
 #zergnet-widget,
 #zergnet-wrapper,
 .component-zergnet,
 .content-zergnet,
 .module-zerg,
 .widget-ami-zergnet,
 .widget_ok_zergnet_widget,
 .zergnet,
 .zergnet-row,
 .zergnet-widget,
 .zergnet-widget-container,
 .zergnetBLock,
 .zergnetpower,
 div[id^="zergnet-widget-"],
 #AD_banner,
 #AdColumn,
 #AdContainer,
 #AdHeader,
 #AdImage,
 #Adcode,
 #AdvertiseFrame,
 #Advertisements,
 #BottomAdContainer,
 #BottomAds,
 #ContentAd,
 #PreRollAd,
 #RightAdBlock,
 #TopAd,
 #WNAd41,
 #ad-area,
 #ad-background,
 #ad-bg,
 #ad-bottom,
 #ad-container,
 #ad-header,
 #ad-header-728x90,
 #ad-leaderboard,
 #ad-main,
 #ad-right,
 #ad-text,
 #ad-top,
 #ad-top-banner-placeholder,
 #ad-top-wrapper,
 #ad-unit,
 #ad-wrapper,
 #ad468,
 #ad728,
 #ad728x90,
 #adBanner,
 #adBelt,
 #adComponentWrapper,
 #adDiv,
 #adFrame,
 #adGallery,
 #adHeader,
 #adHolder,
 #adLayer,
 #adLeader,
 #adPosition0,
 #adText,
 #ad_1,
 #ad_2,
 #ad_3,
 #ad_4,
 #ad_5,
 #ad_728_90,
 #ad_area,
 #ad_banner,
 #ad_center,
 #ad_content,
 #ad_header,
 #ad_leaderboard,
 #ad_overlay,
 #ad_space,
 #ad_square,
 #ad_table,
 #ad_unit,
 #ad_wrap,
 #ad_wrapper,
 #adaptv_ad_player_div,
 #adbackground,
 #adbanner,
 #adbar,
 #adblock,
 #adboard,
 #adbody,
 #adbox,
 #adcode,
 #adcontainer,
 #adcontainer1,
 #adcontent,
 #adhead,
 #adheader,
 #adimg1,
 #adlayer,
 #adnews,
 #adposition3,
 #adright,
 #ads-col,
 #adsHeader,
 #ads_bottom,
 #ads_right,
 #ads_top,
 #ads_wrapper,
 #adsdiv,
 #adsense,
 #adsense_block,
 #adsense_inline,
 #adsensewide,
 #adspace,
 #adspace_top,
 #adspot-300x250-pos-1,
 #adspot-300x250-pos-2,
 #adtext,
 #adtop,
 #adv-masthead,
 #adv-top,
 #advert1,
 #advert2,
 #advert_box,
 #advertise,
 #advertisement1,
 #advertisetop,
 #advertising_wrapper,
 #adverts,
 #advtop,
 #adwrapper,
 #banner-ad,
 #bannerAd,
 #bannerAdWrapper,
 #banner_topad,
 #bannerad,
 #bigAd,
 #bigad,
 #body_ad,
 #bottomAd,
 #bottomAds,
 #bottom_ad,
 #centerads,
 #cmn_ad_tag_head,
 #companionAd,
 #content-header-ad,
 #contentAd,
 #content_ads,
 #content_adv,
 #contentad,
 #dart-container-728x90,
 #dfp_ad_Entry_728x90,
 #dfp_ad_Home_728x90,
 #divAd,
 #div_prerollAd_1,
 #download_ad,
 #featuread,
 #featured-ads,
 #featuredAds,
 #footer_ad,
 #footer_ads,
 #game-ad,
 #googlead,
 #gridAdSidebar,
 #head-ad,
 #header-ads,
 #headerAd,
 #headerAdContainer,
 #header_ad,
 #homead,
 #ka_adRightSkyscraperWide,
 #leaderAd,
 #leaderBoardAd,
 #leaderboard-ad,
 #leaderboard-advertisement,
 #leaderboardad,
 #left-ad,
 #left_ads,
 #leftad,
 #leftads,
 #logoAd,
 #logo_ad,
 #mainAd,
 #main_ad,
 #mpu2,
 #mpu2_container,
 #mpu_container,
 #msad,
 #myAd,
 #player_ads,
 #pre_advertising_wrapper,
 #prerollAd,
 #promo-ad,
 #publicidad,
 #reklama,
 #rh-ad,
 #right_ads,
 #right_adsense,
 #search-sponsor,
 #searchAd,
 #search_ads,
 #sideAd,
 #side_ads,
 #sidebar-ads,
 #sidebar_ad,
 #sidebar_ads,
 #skybox-ad,
 #sponsorAdDiv,
 #sponsorText,
 #sponsoredlinks,
 #sponsors-home,
 #takeover_ad,
 #top-ad,
 #topAd,
 #topAdSpace,
 #topAdSpace_div,
 #topAdvert,
 #topBannerAd,
 #top_ad,
 #top_ads,
 #topad,
 #topadvert,
 #topbannerad,
 #under_story_ad,
 #videoAd,
 .ADBAR,
 .AdBody:not(body),
 .AdBox,
 .AdInfo,
 .AdTitle,
 .AdvertContainer,
 .HomeAds,
 .IM_ad_unit,
 .RelatedAds,
 .SponsoredContent,
 .ad-300x250,
 .ad-banner,
 .ad-block,
 .ad-body,
 .ad-border,
 .ad-btn,
 .ad-button,
 .ad-cat,
 .ad-cell,
 .ad-display,
 .ad-enabled,
 .ad-header,
 .ad-holder,
 .ad-img,
 .ad-inner,
 .ad-item,
 .ad-leader-top,
 .ad-leaderboard,
 .ad-left,
 .ad-link,
 .ad-links,
 .ad-panel,
 .ad-placement,
 .ad-right,
 .ad-section,
 .ad-served,
 .ad-sidebar,
 .ad-square,
 .ad-stack,
 .ad-text,
 .ad-top,
 .ad-unit,
 .ad-unit-300-wrapper,
 .ad-vertical-container,
 .ad-wide,
 .ad-wrap,
 .ad-wrapper,
 .ad300,
 .ad468,
 .ad728,
 .ad90,
 .adBlock,
 .adBottomBoard,
 .adBox,
 .adContent,
 .adDiv,
 .adElement,
 .adFrame,
 .adFrameCnt,
 .adHead,
 .adHeader,
 .adHeaderblack,
 .adHeadline,
 .adHolder,
 .adHoldert,
 .adImg,
 .adItem,
 .adLink,
 .adMessage,
 .adMiddle,
 .adMod,
 .adModule,
 .adOverlay,
 .adPanel,
 .adPod,
 .adResult,
 .adRight,
 .adRotator,
 .adSpace,
 .adSpot,
 .adText,
 .adTitle,
 .adTopHome,
 .adWidget,
 .adWrap,
 .ad_1,
 .ad_160,
 .ad_160x600,
 .ad_2,
 .ad_3,
 .ad_728x90,
 .ad_960,
 .ad_Right,
 .ad_block,
 .ad_body,
 .ad_container,
 .ad_description,
 .ad_global_header,
 .ad_head_rectangle,
 .ad_header,
 .ad_img,
 .ad_item,
 .ad_leaderboard,
 .ad_line,
 .ad_middle,
 .ad_outer,
 .ad_promo,
 .ad_slug_table,
 .ad_space,
 .ad_spot,
 .ad_text,
 .ad_title,
 .ad_trick_header,
 .ad_trick_left,
 .ad_wrap,
 .ad_wrapper,
 .adarea,
 .adbanner,
 .adbar,
 .adbottom,
 .adbutton,
 .adcolumn,
 .adcont,
 .addiv,
 .adframe,
 .adfree,
 .adheader,
 .adholder,
 .adinfo,
 .adkit,
 .adlink,
 .adlist,
 .admain,
 .admiddle,
 .adright,
 .adrow1,
 .adrow2,
 .ads-1,
 .ads-2,
 .ads-3,
 .ads-area,
 .ads-col,
 .ads-header,
 .ads-holder,
 .ads-inline,
 .ads-item,
 .ads-right,
 .ads-section,
 .ads-title,
 .ads-top,
 .ads1,
 .adsBlock,
 .adsWidget,
 .ads_catDiv,
 .ads_div,
 .ads_top,
 .ads_wrapper,
 .adsbottombox,
 .adsbox,
 .adsbygoogle,
 .adscontainer,
 .adshome,
 .adside,
 .adslot,
 .adslot_blurred,
 .adspace,
 .adtable,
 .adtile,
 .adtop,
 .adv300,
 .adv_300,
 .advert-block,
 .advert-box,
 .advert-container,
 .advert-content,
 .advert-horizontal,
 .advert-wrapper,
 .advert2,
 .advertColumn,
 .advertContainer,
 .advertLink,
 .advertText,
 .advert_area,
 .advert_container,
 .advert_list,
 .advertbox,
 .advertisement-1,
 .advertisement-block,
 .advertisement-swimlane,
 .advertiser,
 .advertising_banner,
 .advertising_block,
 .advertisment,
 .advertorial,
 .adverts,
 .adverttext,
 .adwords,
 .afs_ads,
 .after-post-ad,
 .article_ad,
 .b-advert,
 .banner-ads,
 .banner160x600,
 .banner300,
 .bannerAd,
 .banner_728x90,
 .banner_ad,
 .bannerad,
 .bigads,
 .block-ad,
 .block-simpleads,
 .blog-ads,
 .bottom-ad,
 .bottom-ads,
 .bottom-left-ad,
 .bottomAds,
 .bottom_ad_block,
 .box-ads,
 .box-radvert,
 .boxad,
 .can_ad_slug,
 .category-ad,
 .change_AdContainer,
 .chitikaAdBlock,
 .container_ad,
 .container_row_ad,
 .contentAd,
 .contentAds,
 .content_ads,
 .content_tagsAdTech,
 .cp-adsInited,
 .custom-ad,
 .desktop-ad,
 .displayAd,
 .download_ad,
 .featured-ad,
 .featuredAdBox,
 .flash-advertisement,
 .footer-ad,
 .footer-ads,
 .footerad,
 .forumAd,
 .gallery-ad,
 .google-sponsored,
 .googleAdSense,
 .googleAds,
 .has-ad,
 .header-ad,
 .headerAd,
 .header_ad,
 .header_ad_center,
 .header_advert,
 .headerad,
 .headerads,
 .home-ad,
 .home-ads,
 .homeAd,
 .homead,
 .homepage-ad,
 .homepage_ads,
 .horizontal_ad,
 .img_ad,
 .imgad,
 .inner_ad,
 .innerad,
 .interstitial_ad_wrapper,
 .ipsAd,
 .item-ads,
 .item-container-ad,
 .leaderboard-ad,
 .leaderboard-ads,
 .leftAd,
 .leftad,
 .list-ad,
 .list-ads,
 .listad,
 .logo-ad,
 .marketing-ad,
 .mid_ad,
 .middle_AD,
 .mod-adopenx,
 .module-ad,
 .newsAd,
 .oasad,
 .openx,
 .page-ad,
 .page_ad,
 .pfAd,
 .player_ad,
 .player_hover_ad,
 .pm-ad,
 .post-ad,
 .post-sponsored,
 .post_ad,
 .post_ads,
 .postad,
 .premiumAdOverlay,
 .premiumAdOverlayClose,
 .promoAd,
 .pub_300x250,
 .pub_300x250m,
 .pub_728x90,
 .pushdown-ad,
 .rail-ad,
 .rbRectAd,
 .rectangle_ad,
 .refreshAds,
 .region-top-ad-position,
 .reklam,
 .reklama,
 .reportAdLink,
 .resultad,
 .right-ad,
 .rightAd,
 .right_ad,
 .right_ads_column,
 .rightad,
 .rightadv,
 .searchAds,
 .searchad,
 .searchads,
 .showAd,
 .side-ad,
 .side-bar-ad-position1,
 .single-ad,
 .singleAd,
 .skinAd,
 .sky_ad,
 .skyscraperAd,
 .slide-ad,
 .smallAd,
 .small_ad,
 .smallads,
 .sponsor-box,
 .sponsorBlock,
 .sponsorBottom,
 .sponsoredLinks,
 .sponsorlink,
 .sticky-ad,
 .story-ad,
 .text-ad,
 .text-ad-links,
 .text-ads,
 .textAd,
 .text_ad,
 .text_ads,
 .textad,
 .textads,
 .top-ad,
 .top-ad-wrapper,
 .topAds,
 .top_ad,
 .top_ad_div,
 .top_ad_wrap,
 .top_ads,
 .topads,
 .tower-ad,
 .type_ads_default,
 .view_ad,
 .wideAd,
 .withAds,
 .wnad,
 .wpInsertInPostAd,
 .yom-ad,
 div[id^="MarketGid"],
 div[id^="div-gpt-ad-"],

7/02/2015

Auto start the network for Centos 7 after rebooting

Open /etc/sysconfig/network-scripts/ifcfg-xxxx file and replace line

ONBOOT=no

with

ONBOOT=yes

save and exit the file, and restart the Centos 7.

Configure PHP-5.5+MySQL-5.6+apache-2.4+CentOS-7 on VirtualBox-4.3

0. Download and install VirtualBox 4.3
   https://www.virtualbox.org/wiki/Downloads

1. Download CentOS 7
   http://www.centos.org/download/

2. Install + configure Network

3.  Update yum
  $sudo yum update
  $sudo yum install gcc kernel-devel kernel-headers
  $sudo reboot

4. Install Virtual LinuxAddtions
    If you meet error with[Building the OpenGL support module  [FAILED]] ,      please use the following command

$sudo export MAKE='/usr/bin/gmake -i'
$sudo ./VBoxLinuxAdditions.run

if you still have errors, please try
$sudo /etc/init.d/vboxadd setup

5. Install apache 2.4
$sudo yum install httpd
$sudo systemctl start  httpd.service
$sudo systemctl enable httpd
$sudo  systemctl list-unit-files|grep httpd
         httpd.service                               enabled

6. Install Remi Repo
$sudo yum install http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
$sudo yum install http://rpms.famillecollet.com/enterprise/7/remi/x86_64/php55-2.0-2.el7.remi.x86_64.rpm

7. Open 80 port
$sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$sudo firewall-cmd --reload


8.  Confirm the httpd from browser
  http://127.0.0.1


9. Install PHP5.5

$sudo yum install --enablerepo=remi-php55 php php-common php-mbstring php-xml php-mysqlnd php-pdo php-devel php-mcrypt




10. Restart the apache
$sudo systemctl restart  httpd.service


11. Install MySQL 5.6
$sudo yum install http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
$sudo yum install mysql mysql-server
$sudo chkconfig mysqld on
$sudo chkconfig --list mysqld 
    mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off



12.  Restart Apache

$sudo systemctl restart  httpd.service

5/22/2015

Configuring Apache to run Python Scripts and MySQL on Centos

    In order to setup a website based on python, you should install python, apache, and mysql. You may use msyql or mysql-connector to connect mysql.

1. Install Python
     $ yum install python

2. Install Apache
    $ yum install httpd

3. Configure Apache for Python
    $ vi /etc/httpd/conf/httpd.conf

     DirectoryIndex index.py

    
    <Directory /var/www/web/app>
        Options +ExecCGI
        AddHandler cgi-script .py
    </Directory>
   


4. Confirmation

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print "Hello World!"


5. Install MYSQL
    $ yum install MySQL-python

6. Test Example

# import mysql
import MySQLdb

db = MySQLdb.connect("localhost","user","password","test" )

# prepare a cursor object using cursor() method
cursor = db.cursor()

# execute SQL query using execute() method.
cursor.execute("SELECT VERSION()")

# Fetch a single row using fetchone() method.
data = cursor.fetchone()

print "Database version : %s " % data

# disconnect from server
db.close()


7. Install MYSQL Connector
    $ yum install mysql-connector-python

8. Test Example

# import mysql connector
from mysql.connector import (connection)

cnx = connection.MySQLConnection(user='user', password='password',
                                 host='localhost',
                                 database='test')
cursor = cnx.cursor()

cursor.execute("SELECT VERSION()")

# Fetch a single row using fetchone() method.
data = cursor.fetchone()

print "Database version : %s " % data

cnx.close()

2/18/2015

Download PDF file or View PDF file on browser by PHP

View pdf file on browser by PHP


 $file = '63f78a20ccab015aaa7a76f8161e665d.pdf';
  $filename = 'filename.pdf';
  header('Content-type: application/pdf');
  header('Content-Disposition: inline; filename="' . $filename . '"');
  header('Content-Transfer-Encoding: binary');
  header('Accept-Ranges: bytes');
  @readfile($file);



Download pdf file by PHP


$file = '63f78a20ccab015aaa7a76f8161e665d.pdf';
$filename = 'filename.pdf';
header("Content-Disposition: attachment; filename=" .  $filename);  
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
@readfile($file); 

2/02/2015

update mysql 5.5 to 5.6 by yum on Centos

Now MySQL provides the repos for mysql-server (http://dev.mysql.com/downloads/repo/). So we may use it and install or update mysql.

1. Add repo for msyql
   # rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

2. View Repo of mysql
   #  less  /etc/yum.repos.d/mysql-community.repo


# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=0

3. Back your database
  # msyqldump -uroot -p --databases database-name1 database-name2 > /tmp/backup.sql

4. Update your msyql
     # yum [install | update] mysql-server

5. Check the version of your mysql
    # mysql --version


   

12/22/2014

Fatal error: Cannot pass parameter 1 by reference

Example for Fatal error: Cannot pass parameter 1 by reference

1. &
/***************Error*******************/
$a = test(array());

echo $a;
function test(&$value=array())
{
    return $value;
}
/**********************************/

/***************Correct*******************/
$value=array();
$a =test($value);
print_r ($a);
function test(&$value=array())

    return $value;
}
/**********************************/


10/28/2014

How to keep ssh alive on centos

By default, the SSH servers are set to disconnect clients who has been inactive or idle after a certain period of time. In order to keep the ssh session alive, you may configure the ssh server.

You may change the ClientAliveInterval, TCPKeepAlive and ClientAliveCountMax options in the sshd configuration file. After you config your ssh, please do not forget to restart your ssh server.

#sudo vi /etc/ssh/sshd_config

ClientAliveInterval 100
TCPKeepAlive  yes
ClientAliveCountMax  99999

#sudo  /etc/init.d/sshd restart


10/05/2014

htaccess to redirect to different domain name

In order to implement direction for different domain on htaccess, please use the following configuration.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^aaaa/([0-9]+)\.html$ /index.php?action=A&sid=$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^bbbb/([0-9]+)\.html$ /index.php?action=B&sid=$1 [QSA,L]

9/05/2014

Install PHP55 on centos 6 based remi repos

To install php55 on centos, you need download the remi repository. Please follow the following steps to complete:
1. Download repo
   sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

2. Confirm the remi.repo
    /etc/yum.repos.d/remi.repo

   [remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Les RPM de remi de PHP 5.5 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php55/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
gpgcheck=1

............
3. Install PHP55
   sudo yum install --enablerepo=remi --enablerepo=remi-php55 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug

4. Confirm the version of php
    php --version


  PHP 5.5.16 (cli) (built: Sep  3 2014 20:08:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies 


Note
 Please use the following command if you have installed PHP on your server
   yum --enablerepo=remi-php55,remi update php\*





    

8/09/2014

ISSN Number Checker

ISSN numbers consist of 8 digits. 

To check validity of an ISSN number enter the 8 digit ISSN number in the box below. 

You may also enter one issn with hyphen, e.g. 1694-0814

http://journalseeker.researchbib.com/?action=issnChecker

6/06/2014

Error: Package: google-chrome-stable-XXXXXXX.x86_64 (google-chrome) Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)

When you install chrome on centos, you may require to install : libstdc++.so.6(GLIBCXX_3.4.15)(64bit).









The error may be like:
Error: Package: google-chrome-stable-35.0.1916.114-1.x86_64 (google-chrome)
           Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)

Now you may try to install chromium compiled for centos.


1. Download
    wget http://people.centos.org/hughesjr/chromium/6/x86_64/RPMS/chromium-31.0.1650.63-2.el6.x86_64.rpm

2.install
   rpm -ivh chromium-31.0.1650.63-2.el6.x86_64.rpm




Now you may use chrome on your centos.

6/05/2014

MYSQL Unix time stamp conversion

When you want to convert the time stamp on mysql, please use the following code

1. time stamp to time
select FROM_UNIXTIME(1425933810);
+---------------------------+
| FROM_UNIXTIME(1425933810) |
+---------------------------+
| 2015-03-10 05:43:30       |
+---------------------------+
1 row in set (0.00 sec)

2. time to time stamp

select UNIX_TIMESTAMP('2015-11-06 10:10:10');
+---------------------------------------+
| UNIX_TIMESTAMP('2015-11-06 10:10:10') |
+---------------------------------------+
|                            1446772210 |
+---------------------------------------+
1 row in set (0.00 sec)

5/13/2014

configure SVN server

Install
 # yum install mod_dav_svn subversion

Configure Apache
  #vi /etc/httpd/conf/httpd.conf

  LoadModule dav_module modules/mod_dav.so

Configure subversion
 # vi /etc/httpd/cond.d/subversion.conf


LoadModule dav_svn_module     /usr/lib/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module   /usr/lib/httpd/modules/mod_authz_svn.so
...

   DAV svn
   SVNParentPath /home/svn
< Location /repos>
   DAV svn
   SVNParentPath /home/svn
#
#   # Limit write permission to list of valid users.
#   < LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
#      AuthType Basic
#      AuthName "Authorization Realm"
#      AuthUserFile /path/to/passwdfile
#      Require valid-user

#
#       
#     Order Deny,Allow
#        Deny from all
#      Allow from 192.168.  

#
#  < /LimitExcept>
< /Location>  

 

Create repos
# mkdir /home/svn
# svnadmin create /home/svn/Test
# chown -R apache:apache /home/svn/Test

Restart the apache
 # service httpd reload

Note:
SVNPath: for single svn project
SVNParentPath: for multiple svn project
If you use  SVNParentPath, you should access sub-svn from the browser, or you will get
------------------------------------------------------------

Forbidden

You don't have permission to access /repos on this server.
--------------------------------------------------------------------------------------
You should access them by http://localhost/repos/sub-svn


p.s.
Create basic auth
htpasswd -c /path/to/passwdfile svn-admin

IP permisison   
       Order Deny,Allow
        Deny from all
        Allow from 192.168.10.126

3/18/2014

Get the client browser language class to realize the Multi-regional and multilingual sites


/**
 * /Language.php
 * $Date::                           #$
 * @version $Rev$
 * @package Language
 */

namespace utility\i18n;

/**
 * Description of Language
 *
 * @package Language
 */
class Language
{

    /**
     * Language parameter
     */
    const LANGUAGE = 'hl';

    /**
     * Default Language
     */
    const DEFAULT_LANGUAGE = 'en';

    /**
     * Supported Language List
     *
     * @var array
     */
    private $supportedLanguage = array(
        'en' => 'English',
        'ja' => '日本語',
        'zh' => '中文',
        'ko' => '한국어',
    );

    /**
     *
     * @var string
     */
    private $languge = 'en';

    /**
     * Language Constructor
     */
    public function __construct()
    {
        $hl = isset($_GET[self::LANGUAGE]) ? $_GET[self::LANGUAGE] : @$_COOKIE[self::LANGUAGE];

        if (!$hl) {
            $hl = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
        }

        $this->setLanguage($hl);
    }

    /**
     * Change the browser language
     *
     * @param string $hl
     * @return \utility\i18n\Language
     */
    public function setLanguage($hl)
    {
        if (!isset($this->supportedLanguage[$hl])) {
            $hl = self::DEFAULT_LANGUAGE;
        }
        $this->languge = $hl;

        return $this;
    }

    /**
     * Return the browser default language
     *
     * @return string
     */
    public function getLanauge()
    {
        return $this->languge;
    }

    /**
     * Return the default langauge name
     *
     * @return string
     */
    public function getLanguageName()
    {
        return $this->supportedLanguage[$this->languge];
    }

    /**
     * Return the supported language list of application
     *
     * @return array
     */
    public function getSupportedLanguage()
    {
        return $this->supportedLanguage;
    }

    /**
     * Return the language instance
     *
     * @staticvar null $instance
     * @return \self
     */
    static public function getInstance()
    {
        static $instance = null;

        if (!$instance) {
            $instance = new self;
        }
        return $instance;
    }

}

Usage


use utility\i18n\Language;


$language = Language::getInstance();
echo $language->getLanguageName();