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! =)

Wednesday, July 24, 2013

Monday, July 22, 2013

How to Change DNS from MYNIC and Get Server Code

How to Change DNS from MYNIC and Get Server Code
  1. Remember Login as technical username, else you cannot notice section of Modify DNS. Admin and technical will have difference CODE to login.
  2. After Login -> go to Domain Name -> Modify Domain Name 
  3. Search for your Domain -> Check the box -> Click Modify
  4. Then you will see the section of Modify Name Servers
  5. After check on Modify Name Servers option radio button, you will see the following list
  6. Now we come to most confusing part, the Server Code is auto generated by the system. But first of all you have to click on "+" button --> enter host name and IPV4 ip --> Click Create button --> System will prompt Error message but it actually showing you the server code number. 
  7. Copy one of the highlighted code and paste into Server Code text box from previous page. Then Click Close button.
  8. Do the same action for Secondary Name Server.
  9. Click Modify button when you finish filling the info. That's all.
  10. Changes of DNS only be activated after 24 hours, then only proceed to your own hosting to do domain addon or domain parking.

~ END ~

Tuesday, July 2, 2013

How to Create Block Programmatically in Drupal 7

How to Create Block Programmatically in Drupal 7:

I try to create with block with update hook but failed. So have to check out with another method which is hook_block. We need to use the following hook:

  • hook_block_info : To define custom block and display block at administration page
  • hook_block_configure : To define custom block configuration block (e.g. title, body, text format)
  • hook_block_save : To save configuration option from hook_block_configure()
  • hook_block_view : To build the contents of the block, can include functionality code

The following link explain how to use the hook
References: http://fourkitchens.com/blog/2012/07/18/building-custom-blocks-drupal-7

The following is the sample how to set text format:

function MODULE_block_configure($delta=''){
  $form = array();

  switch ($delta) {

    case 'blockname':
      # Text field form element
    $form['text_body'] = array(
      '#type' => 'text_format',
      '#title' => t('Enter your html code'),
      '#default_value' => variable_get('text_variable',''),
      '#format' => 'full_html',
      );
      break;
  }
  return $form;
}