Tag: PHP

Stripe Payment Gateway Implementation

Stripe Payment Gateway Implementation: Steps to Implement: Download the stripe package(stripe). Extract that into the web accessible folder. Create an account in stripe using this url: https://manage.stripe.com/login After Created the account get the test secret key and test publishable key from your stripe account using this url: https://manage.stripe.com/account/apikeys Now in config.php file change the “testSecretKey” …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/10/stripe-payment-gateway-implementation/

YII Upload the file to FTP server

The below function used to upload the local file to remote directory. [php] /** * Upload the file in ftp directory * @param string $localFilePath * @param string $remoteFilePath . * @return boolean */ public function CopyFileToFtpBucketDir($localFilePath, $remoteFilePath) { <strong><em>//Credential are configured in main.php</em></strong> $ftpSource = Yii::app()-&gt;params[‘ftpSource’]; $ftpUserName = Yii::app()-&gt;params[‘ftpUserName’]; $ftpPassword = Yii::app()-&gt;params[‘ftpPassword’]; <em><strong>// set …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/10/yii-upload-the-file-to-ftp-server/

How to retrieve the last record in each group using mysql

In single SQL query itself we can retrieve the last record in each group. It will help us to perform action better, faster and simpler. In this post I will explain about you how to do it. Here is my table structure for your reference. [sql] desc post_status; +—————-+————-+——+—–+———+—————-+ | Field | Type | Null …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/10/how-to-retrieve-the-last-record-in-each-group-using-mysql/

How to Reset a WordPress Password from Mysql Server

Its essential thing to knowing, how to reset the wordpress password from Mysql server without following traditional method. Because your site may hacked, you may forgot your admin password and its email id to reset the password, you are no longer able to login into wordpress using login credentials. This method will very useful to …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/09/how-to-reset-a-wordpress-password-from-mysql-server/

MySQL Error – SQL_BIG_SELECTS

While executing JOIN SQL query in live server, i got the following error. [code] The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay: [/code] To resolve this error, I have used the following SQL query before executing the JOIN SQL query. …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/08/mysql-error-sql_big_selects/

YII – set default settings within module and controller

Which helps to overwrite default settings of module and controller. To set default controller, view, layout and theme. Set default controller within module [php] /** * @var string the default controller. */ public $defaultController = ‘controller_name’; [/php] To Set default layout, theme and views within controller, use the following commands. [php] /** * @var string …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/04/yii-set-default-settings-within-module-and-controller/

Hadoop Error: Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out.

If we face the following error while running hadoop jobs http://<masternode ip>:50030/jobtracker.jsp Error: “Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out.” Description: Respective box name <machine name> is not updated in all the cluster configuration files (hadoop and /etc/hosts) Steps to resolve: Step 1: Stop all the hadoop services in master node hduser: /usr/local/hadoop/bin/stop-all.sh Step 2: Edit the …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/hadoop-error-shuffle-error-exceeded-max_failed_unique_fetches-bailing-out/

Installation of Yii

YII – Yes It Is YII is a high-performance PHP framework best for developing large-scale Web applications. Download the latest stable version from http://www.yiiframework.com/ Extract the folder and place it under the webroot location Eg., /var/www/ in linux and htdocs in windows php <path to yii folder>/framework/yiic.php webapp <applicationname> Additionally set the path for php in …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/installation-of-yii/

How to automate whodidit behaviour and timestamps in yii ActiveRecord model?

To automate whodidit and timestamps in yii activerecord model using beforesave() method. If the rule validation got success then only the beforesave() method will invoke. Without satisifying rule() in activerecord model, this method will not work. [php] protected function beforeSave() { if(parent::beforeSave()) { if($this->isNewRecord) { $this->created_on = time(); $this->created_by = (int)Yii::app()->user->id; } $this->updated_on = time(); …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/how-to-automate-whodidit-behaviour-and-timestamps-in-yii-activerecord-model/

How to automate timestamps in activerecord using yii

There are many ways to automate the setting of timestamps in yii ActiveRecord models. In this we are representing three ways here. 1) Update via model’s rules: [php] /** * @return array validation rules for model attributes. */ public function rules() { return array( array(‘title’,’length’,’max’=>255), array(‘title, created_at, updated_at’, ‘required’), array(‘updated_at’,’default’, ‘value’=>new CDbExpression(‘NOW()’), ‘setOnEmpty’=>false,’on’=>’update’), array(‘created_at,updated_at’,’default’, ‘value’=>new …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/03/how-to-automate-timestamps-in-activerecord-using-yii/