Tumgik
codehelpus · 9 years
Photo
Tumblr media
How to store array values in Yii model property In some scenarios, we require to store multiple values in your class attribute of your Yii model.
0 notes
codehelpus · 9 years
Text
How can I avoid direct access to codeigniter controllers, rather than routes?
How to avoid direct access to codeigniter controllers, other than routes?
When we are defining all your URLs through the routes.php file, the direct access to your code-igniter class will make accessible duplicated pages for the website. Duplicated pages affect SEO in large extents, so better to avoid direct access to the controller functions.
Step 1: Create a controller function for 404 response page
Create a separate controller and a normal public function in the…
View On WordPress
0 notes
codehelpus · 9 years
Text
How you can change the server URL for GIT repository
How you can change the server URL for GIT repository
Assume that your origin (repository server URL) is: [email protected]/repository-name.git  and you want to replace it with [email protected]/repository-name.git .
Command to check your current origins:
git remote -v
You will be able to see the origins for both fetch and push operations:
origin [email protected]/repository-name.git (fetch) origin…
View On WordPress
0 notes
codehelpus · 9 years
Text
How to restore the deleted local file from GIT repository
It is very simple to get the locally deleted file in a git repository. Make sure that you are not committed any changes.
Suppose you deleted the file: myfolder/my_deleted_file.txt  accidentally and you want to retrieve the file from the server.
Execute the following command:
git checkout myfolder/my_deleted_file.txt
That’s it. Your file is now restored to the folder.
View On WordPress
0 notes
codehelpus · 9 years
Text
How to copy file from an SSH server to the local computer
How to copy file from an SSH server to the local computer
On Linux systems, it is very easy to copy the files from one computer to another with the secure copy protocol.
Suppose you are logged into the server with SSH and you want to copy the file: /home/user/dummy.txt from the current server folder to your local path: /var/dummy.txt
  Do the following steps:
Exit from the ssh connection.
Make sure that you are logged into your local machine.
Execute…
View On WordPress
0 notes
codehelpus · 9 years
Text
Create a random alphanumeric string with mysql query
Create a random alphanumeric string with mysql query #code #mysql #function
Why we need this?
We used to generate random strings for generating passwords or generating keys which are used for accessing sensitive information through a URL. When you want to generate a unique random key for a table, it is always better to generate the key in mysql rather than the server side scripting language. Generating random key in mysql procedure, avoid multiple key generation and…
View On WordPress
0 notes
codehelpus · 9 years
Text
How to add new action link column for Yii CGridView
How to create a custom action link column for the Yii CGridView widget: http://codehelp.us/blog/add-new-action-link-column-yii-cgridview/
It is very simple to create custom columns in CGridView. While defining the columns, you have to define an array with specific values for the custom column. To create a column which points to another controller with ID parameter, use following code:
array( 'type' => 'raw', 'value' => 'CHtml::link("View Contents", array("Contents/index", "id" => $data->id))', 'htmlOptions' => array("style" =>…
View On WordPress
0 notes
codehelpus · 9 years
Text
CodeIgniter Form Validation - How to get all error fields as an array
CodeIgniter Form Validation - How to get all error fields as an array #codeigniter #form #validation
CodeIgniter by default is not providing you the error fields for a form as an array. To add this feature to your codeigniter form_valiation library, you have to extend the system library and overload as form_validation library.
Create the file: application/libraries/My_Form_validation.php file and add the following code:
class MY_Form_validation extends CI_Form_validation { public function…
View On WordPress
0 notes
codehelpus · 9 years
Text
Tips to change your MySQL Procedure through command shell
Tips to change the MYSQL Procedure through command shell http://codehelp.us/blog/tips-to-change-your-mysql-procedure-through-command-shell/
Drop your procedure before modifications
There is no alter command like table alter in mysql for modifying your MySQL procedure code. So you have to drop your procedure and then create the same procedure for altering your procedure. To drop the procedure, execute the following line of code in your command shell:
DROP PROCEDURE your_database.your_procedure_name;
Note: Mysql ALTER PROCEDURE can be…
View On WordPress
0 notes
codehelpus · 9 years
Text
How to make Yii form fields mandatory manually
How to make your Yii form fields mandatory manually: http://codehelp.us/blog/make-yii-form-fields-mandatory/ #Yii #MVC #PHP
When you generate the model and CRUD files, usually all rules in the model is generated automatically and you are not bothered about the rules. But if you want to manually make fields in a form mandatory, you have to write a simple rule in the model rules function – array. Suppose I am having username, email and password in my form and I want all fields to be mandatory. The rules function will be…
View On WordPress
0 notes
codehelpus · 9 years
Text
Change your Yii view directory name for your controller
How to use custom Yii view directory names for your controllers: http://codehelp.us/blog/change-your-yi…our-controller/ #yii #yiiframework
This article will assist you to use custom folder names rather than generating folder names for your controller. Suppose you have a model named: “MySample“, your generated controller name will be: “MySampleController”; your view folder name will be “views/mySample“. If you want to change your view name from views/mySample to views/sample, add the below function to your controller and change the…
View On WordPress
0 notes
codehelpus · 9 years
Text
Run your admin panel website under port 9000 on the apache web server
Run your admin panel website under port 9000 on the Apache Windows Server http://codehelp.us/blog/run-website-port-apache-server #apache
It is very simple to run your admin panel website or your projects in different ports with Apache web server. The simple instruction to do so is given below.
Open your httpd.conf file and add the following lines of code at the end of the line:
Listen 9000 NameVirtualHost *:9000 <VirtualHost *:9000> DocumentRoot "C:/your_server_folder/your_project_folder" ServerName localhost </VirtualHost>
View On WordPress
0 notes
codehelpus · 9 years
Text
Sending Push Notification in Drupal with your plugin
How to send Push Notifications in drupal from your custom plugin: http://codehelp.us/blog/?p=37 #Drupal #PushNotification
It is difficult to implement even simple features in Drupal. Luckily Drupal is one of the CMS which have the largest number of plugins (modules). For implementing push notification feature, there are some good plugins available. We are selecting one plugin from the module gallery and will try to implement the push notification feature for our custom developed module.
Drupal’s “Push Notifications”…
View On WordPress
0 notes
codehelpus · 9 years
Text
Drupal Push Notifications Module's Functions List (API Manuel)
Drupal Push Notifications Module's Functions List (API Manuel) #drupal #APNS
The goal of this article is to give developers’ awareness about the functions included in the push notification module that can be used for your Drupal module development. There are 20 functions available in the push notification module from which I am selecting 5 functions that can be used for your module to send notifications to APNS and GCM/C2DN services:
push_notifications_send_message
This…
View On WordPress
0 notes
codehelpus · 9 years
Text
How to make your Linux Apache run under a particular user
How to make your Linux Apache run under a particular user #apache #linux
It is common to see errors like: “permission denied”, that you can see in your applications after uploading the code to your Linux server. You can simply change many of these errors by providing the proper permissions to apache running on your server.
To change the apache running user, execute the below command and open the file with vim:
sudo vim /etc/apache2/envvars
Look through the file…
View On WordPress
0 notes
codehelpus · 9 years
Text
Sending email from your Codeigniter application with Gmail SMTP
Sending email from your application with Gmail
With the Codeigniter’s default email library, we can send email through our Gmail account. This will help us to avoid spam mails, generating from the Codeigniter application.
1. Create GMAIL Configuration for the email configuration
You only have to take care of your email configuration to implement email sending properly for your application. Open your application/config/config.php file and add…
View On WordPress
0 notes
codehelpus · 9 years
Text
How to create a new branch in the GIT file repository
It is a common practice that you have to create a new branch for developing the new sprint (agile based development) or a new development phase. With GIT repository, it is very easy to create and work with new branch as you go.
Note: For windows developers, use CygWin for the command console. This will help you to create a virtual Linux like environment in windows system.
1. Create your GIT…
View On WordPress
0 notes