Creating a Bake template for Dummies

So I finally started working on CakePHP…and it wasn’t easy at the start. I am writing this blog because there might be others who would face the same issues. Having gone through cake for 2 days, I feel that it is one of the awesomest thing ever. The best part that I like is the Cake Console. I haven’t used most of it, but from my point of view(the beginner‘s point of view!!), it is very helpful once you start figuring it out.

So first after understanding the basic structure and all, I knew that I could make(bake) a CRUD using the cake console. The command for it is pretty simple.

bin/cake bake all tablename

Continue reading “Creating a Bake template for Dummies”


PHP 7 to PHP 5.6 downgrade on Ubuntu 16.04

Hey there!!

Writing after quite some time. I forgot why I used to write and hence the blogs didn’t update. So here I go again!!

So, I recently did an upgrade from my good old Ubuntu 14.04 to Ubuntu 16.04 and as a web developer, I obviously have the LAMP stack installed in my system. So what happened during the upgrade was that my system updated php from 5.x to 7.0(not stable at the time of writing this post!) which is default in Ubuntu 16.04 (found this after quite some time of research!)

I had to downgrade due to some very special reasons. One of them might have been that my production server did not have the super efficient php7 engine and hence was running out of memory on a recursive function. I had to replicate the error on my local machine but with PHP7, I was not running out of memory (even with the same memory limitations. I am happy and sad at the same time now!!)

So I took the decision to downgrade.
Continue reading “PHP 7 to PHP 5.6 downgrade on Ubuntu 16.04”

www to non-www redirection using htaccess

A simple way to redirect the URL from to without making any changes to the server will be to use htaccess.

So, I am sharing code for the same.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Paste this code in your .htaccess file in your home directory and voila!!

Check and enable mod_rewrite if htaccess not working

So, I faced this issue, ny htaccess was not working and my API was pathetically useless because of this.
So I decided to check this with my server.

Create a PHP file on the Apache server. Write the below code inside it.


Now call the file in your browser (This means, put the file URL in the browser and press ENTER).
Once done, you will see info about your php. Press Ctrl+F and search for “mod_rewrite”.
If present, then please do not read any further as your issue is then different from mine.
Continue reading “Check and enable mod_rewrite if htaccess not working”

Showing Custom Pager (of counts) in CodeIgniter – Showing X to Y of Z results

Pagination in CodeIgniter is not at all perfect. Nothing is, as a matter of fact.

So one day, I had to implement this “Showing X to Y of Z results” in my SCRUD and I could not find anything on the CI website about it. A helpful Stackoverflow post was what came to the rescue. But as they say,

There is always room for improvisation.

So I made some new changes and implemented it my way. So, here goes, Continue reading “Showing Custom Pager (of counts) in CodeIgniter – Showing X to Y of Z results”

Installing Latest Eclipse in Ubuntu

We all know that Ubuntu has its own app store.
However, it was not upto the expectations when I wanted to install Eclipse into it.

The app store had the basic package which did not meet my needs and someone had commented that the eclipse had not been updated since a long time on that store.

So, I went on to Google and found some 2 or 3 beautiful ways to install Eclipse into Ubuntu. I had to make some changes in their methods so as to refine the method. But mostly, its pretty cool stuff.

So, here we go!! Continue reading “Installing Latest Eclipse in Ubuntu”