Thursday, April 3, 2014

Property "CClientScript.scripts" is not defined.

Property "CClientScript.scripts" is not defined.

Cause:
Most probably happened when it cannot locate yii file.

Solution:
Check the path from index.php file and yiic.php file. Make sure it point to Yii Root.

Yii Load data into select option list box dynamically + sorting

I would like to share how to sort list and load data into list box in yii.

Let say we have member table like Member(id, mid, name),

Controller File

<?php
class SignupController extends Controller
{
public function actionGetMember(){
    $json = array();
    $records = Member::model()->findAll(array('order'=>'id'));

    $count_records = count($records);
    if($count_records > 0){
      $json = array();
      foreach ($records as $record) {
        array_push($json, $record->attributes);
      }
    }

    echo json_encode($json);
}
}

?>

==============================
Js File

jQuery(function($) {

// To call profession and specialty listing
  $.ajax({
    url: 'signup/GetMember',
    type: 'GET',
    dataType: 'json',
    success: function(data) {
      $.each(data, function(index, element) {
        $("<option></option>", {value: element['mid'], text: element['name']}).appendTo('#User');
      });
    }
  });

});

===========================
View File

<select id="User">
<option>Please select:</option>
</select>

Sunday, September 15, 2013

Free Screen Recorder Application

Active Presenter a great screen capture recorder application which is very easy to use, high quality of video output and also allow you to include voice in the presentation. 

Download HERE


Monday, August 19, 2013

Naming Convention in Programming

Summary from wikipedia

Classes

- Name should be nouns in UpperCamelCase
- Use whole words (avoid acronyms and abbreviations)
- e.g. : class Raster; class ImageSprite

Methods

- should be verbs in lowerCamelCase
- first letters of subsequent words in uppercase
- e.g.: run(); runFast(); getBackground();

Variables

- written in lowerCamelCase
- should not start with underscore( _ ) or ($) characters
- should be used prefix all instance variables
- keep short and meaningful
- avoid one character
- e.g. : float myWidth

Constants

- should be written in uppercase characters seperated by underscores
- my contain digits if appropriate but not first character
- e.g.: final static int MAX_PARTICIPANTS

Friday, August 16, 2013

How to Remove Delta Search Malware

I got Delta Search by installing Free Movie Maker without notice, it stick to all browser. Whenever i open any browser, it will be my default search engine. According to the expert, it is not safe to use as it will track personal data like credit card information. So be alert!

If you are not lucky like me, you can follow the link. It teach you step by step how to remove the malware.


Wish you luck! =)