How to create static page in CakePHP.

1. Under View > Pages create hello.ctp

2. Under Config folder open routes.php and add the following code:

Router::connect('/hello', array('controller' => 'pages', 'action' => 'display', 'hello'));

3. Now open your static page via: http://yourdomain/hello

How to call hidden div tags by ID or Class in Jquery

How to call hidden div tags by ID or Class in Jquery.

code

Example:

HTML:

<div id="off" style="display:none">
      <p> Show me </p>
</div>

<button id="load">Load Selected DIV</button>

Script:

<script type="text/javascript"> 
$(function(){
$("#load").click(function(e){ 
 e.preventDefault();
 $("#off:hidden").slice(0, 10).show(); 
 if ($("#off:hidden").length == 0){ 
 return false;
 }
 });
});
</script>

If you have better solutions, please share in the comments. Thank you!

CentOS 6.5 – How to boot into graphical Environment

There are ways to boot CentOS into graphical Environment. If you just want to overview and explore the graphical interface of CentOS here’s what you need to do,

1. Login as root with administrator privilege.

2. Type the following:

startx

however, this is just a one-time fix and does not change the log in process for future log ins.

To Setup your default boot with Graphical Interface you need to modify /etc/inittab 

1. Login with administrator privilege using su

2. Type the following and hit Enter.

vi /etc/inittab

Once you’re in, you will see the following text:

# Default runlevel. The runlevels used by RHS are: 
#   0 - halt (Do NOT set initdefault to this) 
#   1 - Single user mode 
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking) 
#   3 - Full multiuser mode 
#   4 - unused 
#   5 - X11 
#   6 - reboot (Do NOT set initdefault to this) 
#  id:3:initdefault:

You need to change the default init ID to: 5 (X11)

id:5:initdefault:

Here’s how to do:

– press i in your keyboard.

– change the value from 3 to 5

– press esc in your keyboard

– Hold Shift + Q

– Type wq then hit Enter to save the changes.

– Ctrl + Alt + Del to restart or type reboot.

You’re Done!

If you have any questions or corrections to my tutorial, feel free to comment.

Thank you!